https://github.com/edgeimpulse/example-standalone-inferencing-avh
Example Standalone for Arm Virtual Hardware using CMSIS toolbox
https://github.com/edgeimpulse/example-standalone-inferencing-avh
arm avh csolution fvp
Last synced: about 1 year ago
JSON representation
Example Standalone for Arm Virtual Hardware using CMSIS toolbox
- Host: GitHub
- URL: https://github.com/edgeimpulse/example-standalone-inferencing-avh
- Owner: edgeimpulse
- License: bsd-3-clause-clear
- Created: 2024-04-11T10:12:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-10T09:58:59.000Z (over 1 year ago)
- Last Synced: 2025-03-07T00:58:40.713Z (about 1 year ago)
- Topics: arm, avh, csolution, fvp
- Language: C++
- Homepage:
- Size: 189 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Edge Impulse Example: stand-alone inferencing for CMSIS toolbox
Example standalone inferencing for AVH created for CMSIS toolbox v2.4.0
## Update the model to test
Once you have deployed your model as a Open CMSIS pack, unzip the downloaded file, you will find 2 pack files and a `model.clayer.yml`
To add your model to your component library you need to use the `cpackget` utility:
```sh
cpackget add .pack
```
You probably need to install the Edge Impulse sdk too:
```sh
cpackget add EdgeImpulse.EI-SDK.x.yy.zzpack
```
Then you need to copy the `model.clayer.yml` into the `model` folder.
To test a sample, from you project copy the raw feature you want to test from the processing block and paste it in `feature.h`
```
const float features[] = {
// copy raw features here (for example from the 'Live classification' page)
};
```
## Build the firmware
### Using command line
The most basic compilation command is:
```sh
cbuild inferencing.csolution.yml
```
This command will build for every target and every configuration available, so probably isn't what you are looking for.
To specify a configuration and target (ie speed for CM55):
```sh
cbuild inferencing.csolution.yml --context inferencing.speed+CM55
```
Other useful arguments are:
```sh
--update-rte
```
Update the RTE directory, which contains target specific header.
```sh
--packs
```
Automatically download any missing software packs with cpackget.
```sh
--clean
```
Remove intermediate and output directories
Usually, the most common way to compiler for a specific target and toolchain is:
```sh
cbuild inferencing.csolution.yml --update-rte --packs --context inferencing.speed+CM55 --toolchain GCC
```
Check the [CMSIS-Toolbox User Guide](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/README.md) for a complete overview of the `cbuild` command.
### Using CMSIS toolbox extension
In the CMSIS view, click on the hammer icon.
### Using docker
This repository contains a docker image with the required dependencies for building with gcc and llvm:
```sh
docker build -t standalone-csolution .
```
Copy the content of the deployment for your project in the pack folder.
Build the firmware with the following command:
```sh
docker run --rm -it -v "${PWD}":/app standalone-csolution /bin/bash -c "./build.sh --target --config --toolchain "
```
### Using the build script
You can use the `build.sh` script to compile, target and toolchain can be specified as follow:
```sh
./build.sh --target --config --toolchain
```
The script will also install any package present in the `pack` folder.
> [!Note]
> After building, the bin will be run locally on AVH.
## Run on AVH
The basic usage is:
```sh
-f
```
Some examples:
- Run Test on model for Cortex-M3 (speed) compiled with GCC
```sh
FVP_MPS2_Cortex-M3 -f ./Target/CM3/model_config.txt ./build/CM3/GCC/speed/outdir/CM3_inferencing.elf
```
- Run Test on model for Cortex-M55 with Ethos (none) compiled with Arm Compiler
```sh
FVP_Corstone_SSE-300_Ethos-U55 -f ./Target/CM55/model_config.txt ./build/CM55/AC6/speed/outdir/CM55_inferencing.elf
```
### Using the build script
You can also use `--run` when invoncing `build.sh` if you want to run an already built target.
For example:
```sh
build.sh --run --target CM7 --toolchain AC6
```
## Available target
CM0
CM0plus
CM3
CM4
CM4-FP
CM7
CM33
CM55
CM55-U128
CM55-U55-128
CM55-U55-128
CM85
## Note
Tested using GCC 10.3.1, GCC 12.3.1, GCC 13.2.1, GCC 13.3.1, Arm Compiler v6.19 and 6.22 and Arm LLVM v17.1.
Doesn't work with GCC 12.2.1 for MCU with Helium (Cortex-M55, Cortex-M85).