Skip to content

Commit 59de650

Browse files
authored
Merge pull request #125 from kshitij-sisodia-arm/feature/mleco-4056
MLECO-4056: Minor updates aligning with new tools.
2 parents 203f01d + 2324df3 commit 59de650

File tree

3 files changed

+102
-61
lines changed

3 files changed

+102
-61
lines changed

cmsis-pack-examples/README.md

Lines changed: 74 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
# CMSIS-Pack based Machine Learning Examples
22

33
- [CMSIS-Pack based Machine Learning Examples](#cmsis-pack-based-machine-learning-examples)
4-
- [Introduction](#introduction)
5-
- [Examples](#examples)
6-
- [Target platforms](#target-platforms)
7-
- [Overview](#overview)
8-
- [Object detection](#object-detection)
9-
- [Keyword spotting](#keyword-spotting)
10-
- [Building the examples](#building-the-examples)
11-
- [Prerequisites](#prerequisites)
12-
- [Tools](#tools)
13-
- [Packs](#packs)
14-
- [Download Software Packs](#download-software-packs)
15-
- [Generate and build the project](#generate-and-build-the-project)
16-
- [Application output](#application-output)
17-
- [Support for Visual Studio Code](#support-for-visual-studio-code)
18-
- [Trademarks](#trademarks)
19-
- [Licenses](#licenses)
20-
- [Troubleshooting and known issues](#troubleshooting-and-known-issues)
21-
22-
## Introduction
4+
- [Introduction](#introduction)
5+
- [Examples](#examples)
6+
- [Target platforms](#target-platforms)
7+
- [Overview](#overview)
8+
- [Object detection](#object-detection)
9+
- [Keyword spotting](#keyword-spotting)
10+
- [Prerequisites](#prerequisites)
11+
- [Support for Visual Studio Code](#support-for-visual-studio-code)
12+
- [Tools](#tools)
13+
- [Packs](#packs)
14+
- [Building the examples](#building-the-examples)
15+
- [Download Software Packs](#download-software-packs)
16+
- [Generate and build the project](#generate-and-build-the-project)
17+
- [Application output](#application-output)
18+
- [Trademarks](#trademarks)
19+
- [Licenses](#licenses)
20+
- [Troubleshooting and known issues](#troubleshooting-and-known-issues)
21+
22+
# Introduction
2323

2424
This repository contains Machine Learning (ML) examples using the CMSIS-Pack from
2525
[ML Embedded Evaluation Kit](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/refs/heads/main).
2626

27-
### Examples
27+
## Examples
2828
Currently, the following examples are supported:
2929

3030
- **Object detection** - detects objects in the input image.
3131
- **Keyword spotting** - detects specific keywords in the input audio stream.
3232

33-
### Target platforms
33+
## Target platforms
3434

3535
Target platforms supported:
3636

@@ -41,12 +41,11 @@ Target platforms supported:
4141
| Alif Ensemble E7 | Physical board | Arm® Cortex®-M55 CPU with Arm® Ethos™-U55 NPU | All |
4242
| STM32F746G-Discovery| Physical board | Arm® Cortex®-M7 CPU | KWS |
4343
| NXP FRDM-K64F | Physical board | Arm® Cortex®-M4 CPU | KWS |
44-
| | | | |
4544

4645

4746
Use this import button to open the solution in Keil Studio Cloud: [![Open in Keil Studio](https://img.shields.io/badge/Keil%20Studio-Import-blue?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNS40LjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCA0NyAxNCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDcgMTQ7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00LjcsN2MwLDIuMiwx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Qo8L3N2Zz4NCg==&logoWidth=47)](https://studio.keil.arm.com/?import=https://github.com/Arm-Examples/mlek-cmsis-pack-examples.git)
4847

49-
## Overview
48+
# Overview
5049

5150
The examples presented in this repository showcase how to build and deploy end-to-end Machine
5251
Learning applications using existing code from various CMSIS-packs. These examples are built
@@ -62,33 +61,45 @@ Therefore, the neural network model files used for Corstone™-300 and Corstone
6261
pre-optimised by the [Vela compiler](https://pypi.org/project/ethos-u-vela/) while the files
6362
used for pure CPU targets are used as they are.
6463

65-
### Object detection
64+
## Object detection
6665

6766
This example uses a neural network model that specialises in detecting human faces in images.
6867
The input size for these images is 192x192 (monochrome) and the smallest face that can be
6968
detected is of size 20x20. The output of the application will be co-ordinates for rectangular
7069
bounding boxes for each detection.
7170

72-
### Keyword spotting
71+
## Keyword spotting
7372

7473
This example can detect up to twelve keywords in the input audio stream. The
7574
[audio file used](./resources/sample_audio.wav) contains the keyword "down" being spoken.
7675

7776
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).
7877

79-
## Building the examples
8078

81-
We recommend using [Keil Studio Cloud](https://studio.keil.arm.com/?import=https://github.com/Arm-Examples/mlek-cmsis-pack-examples.git) for building these examples.
82-
This is by far the easiest way to get started. However, it is possible to build these projects
83-
locally too and the following sections cover the requirements for such a set up.
79+
# Prerequisites
8480

85-
### Prerequisites
81+
We recommend using [Visual Studio Code IDE](https://code.visualstudio.com/) with the
82+
[Keil Studio Pack Extension](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack).
83+
Alternatively, [Keil Studio Cloud](https://studio.keil.arm.com/?import=https://github.com/Arm-Examples/mlek-cmsis-pack-examples.git) can also be used.
84+
85+
These are the easiest ways to get started. However, it is also possible to build these projects
86+
locally via CLI and the following sections cover the requirements for such a set up.
87+
88+
## Support for Visual Studio Code
89+
90+
The [tools required](#tools) can also be used in addition to an extension pack for Visual Studio Code.
91+
See [Arm Keil Studio Pack](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack)
92+
for details on installation and how to use it.
93+
94+
Once the IDE has been set up with the extension, it presents an easy to use interface to build
95+
applications for specific configurations of the different projects and targets from within VS Code,
96+
and also helps with debugging and flashing.
8697

8798
For developing on a local host machine, we recommend a Linux based system as we test
8899
the flow of the instructions in that environment, but a Windows based machine should
89100
also work.
90101

91-
#### Tools
102+
## Tools
92103

93104
The following tools are required if building on a local machine (and not using the project via
94105
Keil Studio Cloud):
@@ -99,9 +110,15 @@ Keil Studio Cloud):
99110
- Access to Arm Virtual Hardware for Corstone™-300 (or Corstone™-310) v11.18.1 or a local
100111
installation of the equivalent Fixed Virtual Platform.
101112

102-
> **NOTE**: For Linux, we recommend using the script installer as this sets up the
103-
> basic paths required the the tools. Otherwise, paths like CMSIS_ROOT_PATH and the
104-
> toolchain root paths in the toolchain CMake files will need to be set manually.
113+
> **NOTE**: For Visual Studio Code, the project contains a
114+
> [vcpkg configuration file](./vcpkg-configuration.json) that helps the required tools to
115+
> be installed without user having to install them manually. We recommend letting the IDE
116+
> handle the installation and environment set up at start up.
117+
>
118+
> If you need to use the CLI tools locally, we recommend using the script
119+
> installer as this sets up the basic paths required for the tools. Otherwise, paths like
120+
> CMSIS_ROOT_PATH and the toolchain root paths in the toolchain CMake files will need to be
121+
> set manually.
105122
> The script installer will prompt for the different paths:
106123
> ```commandline
107124
> $ sudo chmod +x ~/Downloads/cbuild_install.sh
@@ -120,13 +137,16 @@ Keil Studio Cloud):
120137
> $ source /home/user/cmsis-toolbox-linux64/etc/setup
121138
> ```
122139
123-
#### Packs
140+
## Packs
124141
125142
CMSIS-Pack defines a standardized way to deliver software components, device parameters and board
126143
support information and code. A list of available CMSIS-Packs can be found
127144
[here](https://developer.arm.com/tools-and-software/embedded/cmsis/cmsis-packs).
128145
129-
### Download Software Packs
146+
147+
# Building the examples
148+
149+
## Download Software Packs
130150
131151
The [mlek.csolution.yml](./mlek.csolution.yml) file lists the software packs used in all projects. These can be
132152
downloaded using the following command:
@@ -143,9 +163,11 @@ downloaded using the following command:
143163
> $ source /home/user/cmsis-toolbox-linux64/etc/setup
144164
> ```
145165
146-
### Generate and build the project
166+
## Generate and build the project
147167
148168
1. Use the `csolution` command to create `.cprj` project files:
169+
> **NOTE**: This step is automatically executed by the Keil Studio pack extension within VS Code if the tools have been
170+
> set up correctly.
149171
```
150172
$ csolution convert -s ./mlek.csolution.yml
151173
warning csolution: specified device 'MK64FN1M0VLL12' and board mounted device 'MK64FN1M0xxx12' are different
@@ -183,17 +205,18 @@ downloaded using the following command:
183205
/home/user/cmsis-pack-examples/kws/kws.Release+FRDM-K64F.cbuild.yml - info csolution: file generated successfully
184206
/home/user/cmsis-pack-examples/kws/kws.Release+STM32F746-DISCO.cbuild.yml - info csolution: file generated successfully
185207
/home/user/cmsis-pack-examples/mlek.cbuild-idx.yml - info csolution: file generated successfully
208+
```
186209

187-
```
188-
> **NOTE**: A single project could also be generated using the context argument:
189-
> ```commandline
190-
> $ csolution convert -s ./mlek.csolution.yml -c object_detection.Release+AVH-SSE-300-U55
191-
> object-detection/object_detection.Release+AVH-SSE-300-U55.cprj - info csolution: file generated successfully
192-
> ```
193-
```
210+
> **NOTE**: A single project could also be generated using the context argument:
211+
> ```commandline
212+
> $ csolution convert -s ./mlek.csolution.yml -c object_detection.Release+AVH-SSE-300-U55
213+
> object-detection/object_detection.Release+AVH-SSE-300-U55.cprj - info csolution: file generated successfully
214+
> ```
194215

195216
2. Use the `cbuild` command to build an executable file, for example building KWS project in `Debug` type for
196-
`Arm® Corstone™-300` target platform:
217+
`Arm® Corstone™-300` target platform.
218+
> **NOTE**: This step is also executed by the Keil Studio pack extension based on the selected user choices
219+
> on the extension's landing pane within VS Code.
197220
```
198221
$ cbuild ./kws/kws.Debug+AVH-SSE-300-U55.cprj -g "Unix Makefiles" -j 4
199222
info cbuild: Build Invocation 1.5.0 (C) 2023 ARM
@@ -213,7 +236,7 @@ downloaded using the following command:
213236
> 1. During the build process required packs may be downloaded.
214237
> 2. The generator specified depends on CMake and the host platform OS.
215238
216-
### Execute project
239+
## Execute project
217240

218241
The project is configured for execution on Arm Virtual Hardware which removes the requirement for
219242
a physical hardware board.
@@ -255,7 +278,7 @@ $ cbuild ./kws/kws.Release+STM32F746-DISCO.cprj -g "Unix Makefiles" -j 4
255278
$ cp ./out/kws/STM32F746-DISCO/Release/kws.Release+STM32F746-DISCO.bin /media/user/DIS_F746NG/ && sync
256279
```
257280

258-
### Application output
281+
## Application output
259282

260283
Once the project can be built successfully, the execution on target hardware will show output of
261284
the application in `Output` window in Keil Studio Cloud. Currently, this includes the following:
@@ -339,16 +362,7 @@ The output is different for the two example applications:
339362
For STM32F746G-DISCO board, the LCD is also used to display the last keyword detected.
340363

341364

342-
### Support for Visual Studio Code
343-
344-
The tools installed above can also be used in addition to an extension pack for VS Code.
345-
See [Arm Keil Studio Pack](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack)
346-
for details on installation and how to use it.
347-
348-
This can this be used to build applications for specific configurations of the different project
349-
and targets from within VS Code, and also help with debugging and flashing.
350-
351-
## Trademarks
365+
# Trademarks
352366

353367
- Arm® and Cortex® are registered trademarks of Arm® Limited (or its subsidiaries) in the US and/or elsewhere.
354368
- Arm® and Ethos™ are registered trademarks or trademarks of Arm® Limited (or its subsidiaries) in the US and/or
@@ -360,8 +374,9 @@ and targets from within VS Code, and also help with debugging and flashing.
360374
- ST®, STM32® are registered trademarks of companies belonging to the STMicroelectronics Group.
361375
- NXP® and the NXP logo are trademarks of NXP B.V.
362376
- Alif™, Alif Semiconductor™, Crescendo™ and Ensemble™ are all trademarks of Alif Semiconductors.
377+
- Visual Studio Code, VS Code, and the Visual Studio Code icon are trademarks of Microsoft Corporation.
363378

364-
## Licenses
379+
# Licenses
365380

366381
The application samples and [resources](./resources) are provided under the Apache 2.0 license, see [License](./LICENSE).
367382

@@ -375,7 +390,7 @@ into C/C++ arrays to be baked into the example applications.
375390
| Keyword Spotting | Apache 2.0 | [micronet_medium](https://github.com/ARM-software/ML-zoo/raw/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8/) |
376391
| Object Detection | Apache 2.0 | [yolo-fastest_192_face_v4](https://github.com/emza-vs/ModelZoo/blob/v1.0/object_detection/) |
377392

378-
## Troubleshooting and known issues
393+
# Troubleshooting and known issues
379394

380395
Many of the tools we have used are still in beta testing phase and there can be issues we don't
381396
spot immediately. Please help us improve this section by reporting them via GitHub.

cmsis-pack-examples/kws/linker/alif-e7-m55-he.sct

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define MODEL_BASE (SRAM1_BASE + SRAM1_USED_BY_HP)
3737
#define ARENA_SIZE (0x00020000)
3838
#define MODEL_SIZE (0x00026600)
39-
#define SPILL_OVER_CODE_SIZE (0x00004000)
39+
#define SPILL_OVER_CODE_SIZE (0x00008000)
4040
#define DATA_SIZE (SRAM1_USABLE_SIZE - (ARENA_SIZE + MODEL_SIZE + SPILL_OVER_CODE_SIZE))
4141

4242

@@ -90,8 +90,9 @@ LOAD_REGION_1 MODEL_BASE SRAM1_USABLE_SIZE
9090
;-----------------------------------------------------
9191
he_sram1_1 +0 ALIGNALL 4 SPILL_OVER_CODE_SIZE
9292
{
93-
micro_allocator.o (+RO-CODE)
93+
*allocator.o (+RO-CODE)
9494
flatbuffer*.o (+RO-CODE)
95+
KwsProcessing.o (+RO-CODE)
9596
}
9697

9798
;-----------------------------------------------------
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"default-registry": {
3+
"kind": "git",
4+
"baseline": "032d9d0820db290ce9ff644dabfdf564343013ae",
5+
"repository": "https://github.com/microsoft/vcpkg"
6+
},
7+
"registries": [
8+
{
9+
"kind": "artifact",
10+
"location": "https://aka.ms/vcpkg-ce-default",
11+
"name": "microsoft"
12+
},
13+
{
14+
"kind": "artifact",
15+
"location": "https://aka.ms/vcpkg-artifacts-arm",
16+
"name": "arm"
17+
}
18+
],
19+
"requires": {
20+
"microsoft:tools/kitware/cmake": "^3.25.2",
21+
"microsoft:tools/ninja-build/ninja": "^1.10.2",
22+
"arm:tools/open-cmsis-pack/ctools": "^1.5.0",
23+
"arm:compilers/arm/armclang": "^6.18.0"
24+
}
25+
}

0 commit comments

Comments
 (0)