Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applications: Add Artificial Intelligence examples #34

Merged
merged 22 commits into from
Jan 16, 2024

Conversation

hugueskamba
Copy link
Contributor

Description

Add two Machine Learning applications:

  • Keyword Detection
  • Speech Recognition

See individual commits for more information.

⚠️ Please merge with Rebase and Merge instead of Squash and Merge to keep individual commits.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

hugueskamba and others added 4 commits January 13, 2024 02:16
It is possible for the FVP to output characters that
cannot be decoded as UTF-8. This change ensures that
when such characters are encountered they are stripped
out returning the string without them.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
The source code will be the same for all apps.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
The configurations are added for Corstone 300 and 310
to be used for configuring the Ethos NPU by ML applications
to be added.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
The updated version of the `arm-corstone-platform-bsp`
project provides necessary changes to use IO on non-secure
side for Corstone 300 and Corstone 310 platforms.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
@hugueskamba hugueskamba requested a review from a team as a code owner January 13, 2024 23:06
hugueskamba and others added 11 commits January 15, 2024 10:11
Abstract the MPS3 LED native driver so they can be used
by applications.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
Some IRQs are specific to the FVP version of corstone3xx platforms.
The `CORSTONE300_FVP` and `CORSTONE310_FVP` macros should be
defined for the `arm-corstone-platform-bsp` library in order to make
these IRQs available.

Signed-off-by: Ahmed Ismail <[email protected]>
Some ML applications will require more image size.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Increase the clock rate from 60 Hz to 300 Hz mosty to
benefit the execution speed of ML applications.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
A new patch is introduced to modify ISRAM0 to be
non-secure application storage while the secure data
would be placed inside Data tightly coupled memory (DTCM).

The reason behind this change is that ML applications
need more RAM memory than 1MB (ISRAM1 size) which is
the only current RAM storage available. However, with this
change we should have 2MB of RAM (ISRAM0 + ISRAM1 sizes) for
the application (non-secure side).

Signed-off-by: Ahmed Ismail <[email protected]>
This commit is meant to modify Corstone-300 linker files
to be able to run ML applications, the changes are:

- Use both ISRAM0 and ISRAM1 for non-secure data
storage as ML applications would require more RAM space.

- Increase the heap size in the Arm GNU Toolchain linker script
to match Arm Compiler for Embedded's scatter file allocated heap size.
Note that the greater heap size is necessary for Arm Compiler for
Embedded builds of the ML apps.

- Place the neural network models at the DDR space.

- Modify AN552 GNU linker script to match Total Solutions
AN552 GNU linker script as they should be matched to
get ML applications working on Corstone-300

- VSI needs a buffer to transfer audio data from S to NS
space, so in order to provide consistency, VSI
audio buffer would be placed at the DDR space for
Corstone-300 right after where the activation buffer
for SRAM is placed.

Signed-off-by: Ahmed Ismail <[email protected]>
Corstone-310 GNU and ArmClang linker scripts are
modified to use macros which are more descriptive than
magic numbers.

Signed-off-by: Ahmed Ismail <[email protected]>
VSI needs a buffer to transfer audio data from S to NS
space, so in order to provide consistency, VSI
audio buffer would be placed at the DDR space for
Corstone-310 right after where the
activation buffer for SRAM is placed.

Signed-off-by: Ahmed Ismail <[email protected]>
Hooks can now be added by applications to be notified
when the OTA is active or not active.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
Provide caller of event init function information
about the outcome of the initialisation by adding
a return value to the initialisation API.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
This library is added to build Machine Learning (ML) applications.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
@hugueskamba hugueskamba force-pushed the feature/add_ml_applications branch from fbdcf9e to 2c558fd Compare January 15, 2024 14:51
In order for ML applications to access the API headers for the
ML Evaluation Kit libraries, various paths in the
ML Embedded Evaluation Kit's source directory need to be made
available to them as include directories.

Helper libraries have been created with library archives and
include directories added to those helper libraries. ML applications
will link the helper libraries they need, in order to inherit the
library archives for linking and include directories for API headers.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
When performing quality checks with uncrustify,
do not longer override the programming langauge with C.
Instead, let the application detect the language on its own.
This is because C++ files will be added for ML examples
and the C language override for uncrustify introduces
error when it encounters C++ files.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Applications can now have:
* `fail/pass_output.log` files to test the application
  output.
* `fail/pass_ota_output.log` files to the test the
  application output when OTA is tested.

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
* Add all source and header files to build the application
* Update open-iot-sdk-toolchain version to include the `-fno-rtti` C++
  flag
* Remove no longer needed `--specs=nosys.specs` flag as include
   already in the updated version of open-iot-sdk-toolchain
* Update build and run scripts to support keyword-detection application
* Add documentation for the Keyword Detection application

Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Ahmed Ismail <[email protected]>
Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Signed-off-by: Hugues Kamba-Mpiana <[email protected]>
Add keyword-detection and speech-recognition testing with the
available configuration (ETHOS/SOFTWARE) to the CI.

Increase the timeout to accommodate the applications
execution time as it takes longer.

Signed-off-by: Ahmed Ismail <[email protected]>
@hugueskamba hugueskamba force-pushed the feature/add_ml_applications branch from 2c558fd to e514fea Compare January 15, 2024 16:35
@aggarg aggarg merged commit 0d10f6c into FreeRTOS:main Jan 16, 2024
6 checks passed
@hugueskamba hugueskamba deleted the feature/add_ml_applications branch January 16, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants