From 15c750642dc6b2b905acb95859575935c9055e76 Mon Sep 17 00:00:00 2001 From: Evangelos Ganotopoulos Date: Wed, 11 Sep 2024 14:54:30 +0100 Subject: [PATCH] CI workflows for cmsis-pack-examples Adding GitHub integrated CI workflows with documentation updates for CMSIS-Pack based Machine Learning Examples. Change-Id: I8e9ccdfc682c19b808561dba1f61a08e72ab8532 Signed-off-by: Kshitij Sisodia --- cmsis-pack-examples/.ci/README.md | 17 ++++ .../.ci/vcpkg-configuration.json | 17 ++++ .../.github/workflows/AVH-FVP-CI.yml | 85 +++++++++++++++++++ .../.github/workflows/Hardware-CI.yml | 66 ++++++++++++++ .../FVP/FVP_Corstone_SSE-300/fvp_config.txt | 7 ++ .../fvp_config.txt | 8 ++ .../fvp_config.txt | 8 ++ .../FVP/FVP_Corstone_SSE-310/fvp_config.txt | 7 ++ .../fvp_config.txt | 7 ++ cmsis-pack-examples/README.md | 22 +++-- cmsis-pack-examples/vcpkg-configuration.json | 16 ++-- 11 files changed, 243 insertions(+), 17 deletions(-) create mode 100644 cmsis-pack-examples/.ci/README.md create mode 100644 cmsis-pack-examples/.ci/vcpkg-configuration.json create mode 100644 cmsis-pack-examples/.github/workflows/AVH-FVP-CI.yml create mode 100644 cmsis-pack-examples/.github/workflows/Hardware-CI.yml create mode 100644 cmsis-pack-examples/FVP/FVP_Corstone_SSE-300/fvp_config.txt create mode 100644 cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U55/fvp_config.txt create mode 100644 cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U65/fvp_config.txt create mode 100644 cmsis-pack-examples/FVP/FVP_Corstone_SSE-310/fvp_config.txt create mode 100644 cmsis-pack-examples/FVP/FVP_Corstone_SSE-310_Ethos-U65/fvp_config.txt diff --git a/cmsis-pack-examples/.ci/README.md b/cmsis-pack-examples/.ci/README.md new file mode 100644 index 0000000..330c279 --- /dev/null +++ b/cmsis-pack-examples/.ci/README.md @@ -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. diff --git a/cmsis-pack-examples/.ci/vcpkg-configuration.json b/cmsis-pack-examples/.ci/vcpkg-configuration.json new file mode 100644 index 0000000..0e8538b --- /dev/null +++ b/cmsis-pack-examples/.ci/vcpkg-configuration.json @@ -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" + } +} diff --git a/cmsis-pack-examples/.github/workflows/AVH-FVP-CI.yml b/cmsis-pack-examples/.github/workflows/AVH-FVP-CI.yml new file mode 100644 index 0000000..1ac9424 --- /dev/null +++ b/cmsis-pack-examples/.github/workflows/AVH-FVP-CI.yml @@ -0,0 +1,85 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# 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 \ No newline at end of file diff --git a/cmsis-pack-examples/.github/workflows/Hardware-CI.yml b/cmsis-pack-examples/.github/workflows/Hardware-CI.yml new file mode 100644 index 0000000..9f1b51c --- /dev/null +++ b/cmsis-pack-examples/.github/workflows/Hardware-CI.yml @@ -0,0 +1,66 @@ +# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its +# affiliates +# 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 \ No newline at end of file diff --git a/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300/fvp_config.txt b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300/fvp_config.txt new file mode 100644 index 0000000..1453aea --- /dev/null +++ b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300/fvp_config.txt @@ -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) +#--------------------------------------------------------------------------------------------------- diff --git a/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U55/fvp_config.txt b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U55/fvp_config.txt new file mode 100644 index 0000000..8e87ad9 --- /dev/null +++ b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U55/fvp_config.txt @@ -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 +#--------------------------------------------------------------------------------------------------- diff --git a/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U65/fvp_config.txt b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U65/fvp_config.txt new file mode 100644 index 0000000..dc45918 --- /dev/null +++ b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-300_Ethos-U65/fvp_config.txt @@ -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 +#--------------------------------------------------------------------------------------------------- diff --git a/cmsis-pack-examples/FVP/FVP_Corstone_SSE-310/fvp_config.txt b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-310/fvp_config.txt new file mode 100644 index 0000000..9e22a3e --- /dev/null +++ b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-310/fvp_config.txt @@ -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) +#--------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/cmsis-pack-examples/FVP/FVP_Corstone_SSE-310_Ethos-U65/fvp_config.txt b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-310_Ethos-U65/fvp_config.txt new file mode 100644 index 0000000..b105d73 --- /dev/null +++ b/cmsis-pack-examples/FVP/FVP_Corstone_SSE-310_Ethos-U65/fvp_config.txt @@ -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) +#--------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/cmsis-pack-examples/README.md b/cmsis-pack-examples/README.md index 2dac267..7fda3f5 100644 --- a/cmsis-pack-examples/README.md +++ b/cmsis-pack-examples/README.md @@ -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) @@ -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) @@ -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. @@ -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 | @@ -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 @@ -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 @@ -180,7 +188,7 @@ a physical hardware board. - When using a Fixed Virtual Platform installed locally: ```shell - $ -a ./out/kws/AVH-SSE-300-U55/Debug/kws.Debug+AVH-SSE-300-U55.axf -C ethosu.num_macs=256 + $ -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. diff --git a/cmsis-pack-examples/vcpkg-configuration.json b/cmsis-pack-examples/vcpkg-configuration.json index 264a1e4..b739bcb 100644 --- a/cmsis-pack-examples/vcpkg-configuration.json +++ b/cmsis-pack-examples/vcpkg-configuration.json @@ -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" } }