Skip to content

Commit

Permalink
CI workflows for cmsis-pack-examples
Browse files Browse the repository at this point in the history
Adding GitHub integrated CI workflows with documentation updates for
CMSIS-Pack based Machine Learning Examples.

Change-Id: I8e9ccdfc682c19b808561dba1f61a08e72ab8532
Signed-off-by: Kshitij Sisodia <[email protected]>
  • Loading branch information
Evagan2018 authored and kshitij-sisodia-arm committed Sep 13, 2024
1 parent 2321def commit 15c7506
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 17 deletions.
17 changes: 17 additions & 0 deletions cmsis-pack-examples/.ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Continuous Integration (CI) Tests for CMSIS-Pack based Machine Learning Examples


Content of `.ci` Directory | Description
:----------------------------|:-----------------
`vcpkg-configuration.json` | Tool setup for the CI test.


## GitHub Action Workflows

The [GitHub Actions](https://docs.github.com/en/actions) in the directory `.github/workflows` are the scripts for the CI tests. These scripts contain detailed comments about each step that is executed.

These examples use the [Arm® Compiler for Embedded](https://developer.arm.com/Tools%20and%20Software/Arm%20Compiler%20for%20Embedded) (AC6) toolchain. As such all workflows are using this compiler.

- `AVH-FVP-CI.yml` implements the *AVH build and execution test* that runs on [Arm Virtual Hardware - Fixed Virtual Platforms (AVH FVP)](https://arm-software.github.io/AVH/main/simulation/html/index.html) simulation models. The directory `FVP` contains configuration files for the FVP simulation models.

- `Hardware-CI.yml` implmentes the *Hardware build test* that runs on evaluation boards. The output of this build test is stored as artifacts and can be downloaded to the evaluation board for execution.
17 changes: 17 additions & 0 deletions cmsis-pack-examples/.ci/vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"registries": [
{
"name": "arm",
"kind": "artifact",
"location": "https://artifacts.tools.arm.com/vcpkg-registry"
}
],
"requires": {
"arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.4.0",
"arm:tools/kitware/cmake": "^3.28.4",
"arm:tools/ninja-build/ninja": "^1.12.0",
"arm:compilers/arm/armclang": "^6.22.0",
"arm:compilers/arm/arm-none-eabi-gcc": "^13.2.1",
"arm:models/arm/avh-fvp": "^11.26.11"
}
}
85 changes: 85 additions & 0 deletions cmsis-pack-examples/.github/workflows/AVH-FVP-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its
# affiliates <[email protected]>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: AVH build and execution test
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '00 20 * * 6'

jobs:
AVH:
strategy:

matrix:
target: [
{proj: kws, board: AVH-SSE-300, model: FVP_Corstone_SSE-300, uart: mps3_board.uart0},
{proj: kws, board: AVH-SSE-300-U55, model: FVP_Corstone_SSE-300_Ethos-U55, uart: mps3_board.uart0},
{proj: kws, board: AVH-SSE-300-U65, model: FVP_Corstone_SSE-300_Ethos-U65, uart: mps3_board.uart0},
{proj: kws, board: AVH-SSE-310, model: FVP_Corstone_SSE-310, uart: mps3_board.uart0},
{proj: kws, board: AVH-SSE-310-U55, model: FVP_Corstone_SSE-310, uart: mps3_board.uart0},
{proj: kws, board: AVH-SSE-310-U65, model: FVP_Corstone_SSE-310_Ethos-U65, uart: mps3_board.uart0},
{proj: object-detection, board: AVH-SSE-300, model: FVP_Corstone_SSE-300, uart: mps3_board.uart0},
{proj: object-detection, board: AVH-SSE-300-U55, model: FVP_Corstone_SSE-300_Ethos-U55, uart: mps3_board.uart0},
{proj: object-detection, board: AVH-SSE-300-U65, model: FVP_Corstone_SSE-300_Ethos-U65, uart: mps3_board.uart0},
{proj: object-detection, board: AVH-SSE-310, model: FVP_Corstone_SSE-310, uart: mps3_board.uart0},
{proj: object-detection, board: AVH-SSE-310-U55, model: FVP_Corstone_SSE-310, uart: mps3_board.uart0},
{proj: object-detection, board: AVH-SSE-310-U65, model: FVP_Corstone_SSE-310_Ethos-U65, uart: mps3_board.uart0}
]

fail-fast: false

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install tools
uses: ARM-software/cmsis-actions/vcpkg@v1
with:
config: ".ci/vcpkg-configuration.json"

- name: Activate Arm tool license
uses: ARM-software/cmsis-actions/armlm@v1

- name: Build project ${{ matrix.target.proj }} for target ${{ matrix.target.board }} with AC6
run: |
cbuild mlek.csolution.yml --update-rte --packs --context ${{ matrix.target.proj }}+${{ matrix.target.board }}
- name: Execute project ${{ matrix.target.proj }}, target ${{ matrix.target.board }}, build Release on AVH ${{ matrix.target.model }}
if: always()
run: |
${{ matrix.target.model }} \
-a ./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/Release/${{ matrix.target.proj }}.axf \
-f ./FVP/${{ matrix.target.model }}/fvp_config.txt \
-C ${{ matrix.target.uart }}.out_file=./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/Release/fvp_stdout.log \
--simlimit 60 --stat
cat ./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/Release/fvp_stdout.log
- name: Execute project ${{ matrix.target.proj }}, target ${{ matrix.target.board }}, build Debug on AVH ${{ matrix.target.model }}
if: always()
run: |
${{ matrix.target.model }} \
-a ./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/Debug/${{ matrix.target.proj }}.axf \
-f ./FVP/${{ matrix.target.model }}/fvp_config.txt \
-C ${{ matrix.target.uart }}.out_file=./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/Debug/fvp_stdout.log \
--simlimit 60 --stat
cat ./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/Debug/fvp_stdout.log
66 changes: 66 additions & 0 deletions cmsis-pack-examples/.github/workflows/Hardware-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its
# affiliates <[email protected]>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Hardware build test
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '00 20 * * 6'

jobs:
HW:
strategy:

matrix:
target: [
{proj: kws, board: FRDM-K64F},
{proj: kws, board: STM32F746-DISCO}
# {proj: kws, board: Alif-E7-M55-HP},
# {proj: object-detection, board: Alif-E7-M55-HP}
]

fail-fast: false

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install tools
uses: ARM-software/cmsis-actions/vcpkg@v1
with:
config: ".ci/vcpkg-configuration.json"

- name: Activate Arm tool license
uses: ARM-software/cmsis-actions/armlm@v1

- name: Build project ${{ matrix.target.proj }} for target ${{ matrix.target.board }} with AC6
run: |
cbuild mlek.csolution.yml --update-rte --packs --context ${{ matrix.target.proj }}+${{ matrix.target.board }}
- name: Upload build Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.proj }}_${{ matrix.target.board }}_AC6
path: |
./out/${{ matrix.target.proj }}/${{ matrix.target.board }}/
retention-days: 1
7 changes: 7 additions & 0 deletions cmsis-pack-examples/FVP/FVP_Corstone_SSE-300/fvp_config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Notes:
# Parameters:
# instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
#---------------------------------------------------------------------------------------------------
mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
mps3_board.uart0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when a EOT (ASCII 4) char is transmitted (useful for regression tests when semihosting is not available)
#---------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Notes:
# Parameters:
# instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
#---------------------------------------------------------------------------------------------------
mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
mps3_board.uart0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when a EOT (ASCII 4) char is transmitted (useful for regression tests when semihosting is not available)
ethosu.num_macs=256 # (int , init-time) default = '0x80' : Number of 8x8 MACs performed per cycle
#---------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Notes:
# Parameters:
# instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
#---------------------------------------------------------------------------------------------------
mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
mps3_board.uart0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when a EOT (ASCII 4) char is transmitted (useful for regression tests when semihosting is not available)
ethosu.num_macs=256 # (int , init-time) default = '0x100' : Number of 8x8 MACs performed per cycle
#---------------------------------------------------------------------------------------------------
7 changes: 7 additions & 0 deletions cmsis-pack-examples/FVP/FVP_Corstone_SSE-310/fvp_config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Parameters:
# instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
#---------------------------------------------------------------------------------------------------
mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
mps3_board.uart0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when a EOT (ASCII 4) char is transmitted (useful for regression tests when semihosting is not available)
ethosu.num_macs=256 # (int , init-time) default = '0x100' : Number of 8x8 MACs performed per cycle (32, 64, 128, or 256)
#---------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Parameters:
# instance.parameter=value #(type, mode) default = 'def value' : description : [min..max]
#---------------------------------------------------------------------------------------------------
mps3_board.visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation
mps3_board.uart0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when a EOT (ASCII 4) char is transmitted (useful for regression tests when semihosting is not available)
ethosu.num_macs=256 # (int , init-time) default = '0x100' : Number of 8x8 MACs performed per cycle (256 or 512)
#---------------------------------------------------------------------------------------------------
22 changes: 15 additions & 7 deletions cmsis-pack-examples/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![License](https://img.shields.io/github/license/Arm-Examples/mlek-cmsis-pack-examples?label)](https://github.com/Arm-Examples/mlek-cmsis-pack-examples/blob/main/LICENSE)
[![AVH build and execution test](https://img.shields.io/github/actions/workflow/status/Arm-Examples/mlek-cmsis-pack-examples/AVH-FVP-CI.yml?logo=arm&logoColor=0091bd&label=AVH%20build%20and%20execution%20test)](/.github/workflows/AVH-FVP-CI.yml)
[![Hardware build test](https://img.shields.io/github/actions/workflow/status/Arm-Examples/mlek-cmsis-pack-examples/Hardware-CI.yml?logo=arm&logoColor=0091bd&label=Hardware%20build%20test)](./.github/workflows/Hardware-CI.yml)

# CMSIS-Pack based Machine Learning Examples

- [CMSIS-Pack based Machine Learning Examples](#cmsis-pack-based-machine-learning-examples)
Expand All @@ -8,12 +12,13 @@
- [Object detection](#object-detection)
- [Keyword spotting](#keyword-spotting)
- [Prerequisites](#prerequisites)
- [Support for Visual Studio Code](#support-for-visual-studio-code)
- [Tools](#tools)
- [Visual Studio Code](#visual-studio-code)
- [Packs](#packs)
- [Building the examples](#building-the-examples)
- [Launch project in Visual Studio Code](#launch-project-in-visual-studio-code)
- [Download Software Packs](#download-software-packs)
- [Generate and build the project](#generate-and-build-the-project)
- [Execute project](#execute-project)
- [Application output](#application-output)
- [Trademarks](#trademarks)
- [Licenses](#licenses)
Expand All @@ -25,6 +30,7 @@ This repository contains Machine Learning (ML) examples using the CMSIS-Pack fro
[ML Embedded Evaluation Kit](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main).

## Examples

Currently, the following examples are supported:

- **Object detection** - detects objects in the input image.
Expand All @@ -36,8 +42,12 @@ Target platforms supported:

| Name | Type | IP | Examples |
|-----------------------|---------------------|-----------------------------------------------|----------|
| Arm® Corstone™-300 | Virtual or physical | Arm® Cortex®-M55 CPU with Arm® Ethos™-U55 or Arm® Ethos™-U65 NPU | All |
| Arm® Corstone™-310 | Virtual or physical | Arm® Cortex®-M85 CPU with Arm® Ethos™-U55 or Arm® Ethos™-U65 NPU | All |
| Arm® Corstone™-300 | Virtual or physical | Arm® Cortex®-M55 CPU | All |
| Arm® Corstone™-300-U55 | Virtual or physical | Arm® Cortex®-M55 CPU with Arm® Ethos™-U55 | All |
| Arm® Corstone™-300-U65 | Virtual or physical | Arm® Cortex®-M55 CPU with Arm® Ethos™-U65 | All |
| Arm® Corstone™-310 | Virtual or physical | Arm® Cortex®-M85 CPU | All |
| Arm® Corstone™-310 | Virtual or physical | Arm® Cortex®-M85 CPU with Arm® Ethos™-U55 | All |
| Arm® Corstone™-310-U65 | Virtual or physical | Arm® Cortex®-M85 CPU with Arm® Ethos™-U65 NPU | All |
| Alif™ Ensemble™ E7 AI/ML Kit | Physical board | Arm® Cortex®-M55 CPU with Arm® Ethos™-U55 NPU | All |
| STM32® F746G-Discovery| Physical board | Arm® Cortex®-M7 CPU | KWS |
| NXP® FRDM-K64F | Physical board | Arm® Cortex®-M4 CPU | KWS |
Expand Down Expand Up @@ -75,7 +85,6 @@ This example can detect up to twelve keywords in the input audio stream. The

More details about the input for this example can be found [here](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main/docs/use_cases/kws.md#preprocessing-and-feature-extraction).


# Prerequisites

## Visual Studio Code
Expand All @@ -98,7 +107,6 @@ CMSIS-Pack defines a standardized way to deliver software components, device par
support information and code. A list of available CMSIS-Packs can be found
[here](https://developer.arm.com/tools-and-software/embedded/cmsis/cmsis-packs).


# Building the examples

## Launch project in Visual Studio Code
Expand Down Expand Up @@ -180,7 +188,7 @@ a physical hardware board.

- When using a Fixed Virtual Platform installed locally:
```shell
$ <path_to_installed_FVP> -a ./out/kws/AVH-SSE-300-U55/Debug/kws.Debug+AVH-SSE-300-U55.axf -C ethosu.num_macs=256
$ <path_to_installed_FVP> -a ./out/kws/AVH-SSE-300-U55/Debug/kws.Debug+AVH-SSE-300-U55.axf -f ./FVP/FVP_Corstone_SSE-300/fvp_config.txt
```
> **NOTE**: The FVP defaults to running 128 MAC configuration for Arm® Ethos™-U55 NPU.
> However, our default neural network model for the NPU is for 256 MAC configuration.
Expand Down
16 changes: 6 additions & 10 deletions cmsis-pack-examples/vcpkg-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@
},
"registries": [
{
"name": "arm",
"kind": "artifact",
"location": "https://aka.ms/vcpkg-ce-default",
"name": "microsoft"
},
{
"kind": "artifact",
"location": "https://aka.ms/vcpkg-artifacts-arm",
"name": "arm"
"location": "https://artifacts.tools.arm.com/vcpkg-registry"
}
],
"requires": {
"microsoft:tools/kitware/cmake": "^3.25.2",
"microsoft:tools/ninja-build/ninja": "^1.10.2",
"arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.4.0",
"arm:compilers/arm/armclang": "^6.22.0"
"arm:tools/kitware/cmake": "^3.28.4",
"arm:tools/ninja-build/ninja": "^1.12.0",
"arm:compilers/arm/armclang": "^6.22.0",
"arm:models/arm/avh-fvp": "^11.26.11"
}
}

0 comments on commit 15c7506

Please sign in to comment.