Verified Commit 0c0f9d57 authored by Vincent Coubard's avatar Vincent Coubard
Browse files

Reformat files using pre-commit.


Signed-off-by: Vincent Coubard's avatarVincent Coubard <vincent.coubard@arm.com>
parent d1fe95a4
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
---
BasedOnStyle : LLVM
AccessModifierOffset: -4
AlignConsecutiveMacros: true
AlignEscapedNewlinesLeft: true
AllowShortFunctionsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
BinPackArguments : false
BinPackParameters : false
BraceWrapping:
AfterFunction: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
ColumnLimit: 120
IncludeCategories:
- Regex: '^"'
Priority: 2
- Regex: '^<'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentWidth: 4
SortIncludes: false
TabWidth: 4
...
......@@ -2,7 +2,7 @@
name: ATS keyword workflow
# Controls when the action will run.
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
......@@ -25,8 +25,8 @@ jobs:
steps:
- uses: actions/checkout@v2
# Cleanup of previous environment
- name: Cleanup of self hosted runner environment
# Cleanup of previous environment
- name: Cleanup of self hosted runner environment
run : |
rm -rf build
rm -rf venv
......@@ -34,28 +34,28 @@ jobs:
git clean -xfd
git reset --hard
# Boostrap the environment
# Boostrap the environment
- name: Bootstrap environment
run : |
./bootstrap.sh
# Setup python environment
- name: Setup Python environment
- name: Setup Python environment
run: |
python3 -m venv venv
python3 -m venv venv
source venv/bin/activate
pip3 install click imgtool pytest
# Execute CMSIS Build command to build the executable for a Cortex-M55 using Arm Compiler
- name: Build kws application
run : |
source venv/bin/activate
source venv/bin/activate
./build.sh kws
# Execute CMSIS Build command to build the executable for a Cortex-M55 using Arm Compiler
- name: Build blinky application
run : |
source venv/bin/activate
source venv/bin/activate
./build.sh blinky
- name: Archive artifacts
......@@ -70,12 +70,10 @@ jobs:
- name: Run blinky integration test
run : |
source venv/bin/activate
source venv/bin/activate
pytest -s blinky/tests
- name: Run kws integration test
run : |
source venv/bin/activate
pytest -s kws/tests
\ No newline at end of file
source venv/bin/activate
pytest -s kws/tests
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.0
hooks:
- id: clang-format
exclude: >
(?x)^(
bsp/aws_configs/|
bsp/aws_libraries/|
bsp/freertos-platform/|
bsp/default_credentials/|
bsp/tf_m_targets/|
kws/ota/
)
......@@ -10,11 +10,11 @@ include(FetchContent)
set(PRJ_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# Declare relative path to TFM target
# Underscore are used to accomodate TF-M conversion in install folder from dash
# Underscore are used to accomodate TF-M conversion in install folder from dash
# to underscore
set(TFM_PLATFORM_LOCAL_PATH "bsp/tf_m_targets/arm/mps3/an547")
# Declare the Open IoT SDK
# Declare the Open IoT SDK
FetchContent_Declare(
open_iot_sdk
GIT_REPOSITORY https://git.gitlab.arm.com/iot/open-iot-sdk/sdk.git
......@@ -42,12 +42,12 @@ set(MBED_C_LIB "std")
# Set FVP variant
set(VARIANT "FVP")
# Apply TF-M patch
find_package(Git)
# Apply TF-M patch
find_package(Git)
set(TFM_PATCH_COMMAND ${GIT_EXECUTABLE} apply "${PRJ_DIR}/patches/tf-m.patch" || true)
set(ML_PATCH_COMMAND ${GIT_EXECUTABLE} apply "${PRJ_DIR}/patches/ml-embedded-evaluation-kit.patch" || true)
# Make the Open IoT SDK available
# Make the Open IoT SDK available
FetchContent_MakeAvailable(open_iot_sdk)
# get paths for the ml kit
......@@ -61,39 +61,39 @@ set(ml-embedded-evaluation-kit_LIB_DIR ${ml-embedded-evaluation-kit_BINARY_DIR}/
# Setup project
# Start of the project
# Start of the project
project(tfm_ns LANGUAGES C CXX)
# Path to AWS credentials
# Path to AWS credentials
set(AWS_CONFIG_CREDENTIALS_PATH "${PRJ_DIR}/bsp/default_credentials" CACHE STRING "Path to AWS credentials")
# Include module path from Open IoT SDK
list(APPEND CMAKE_MODULE_PATH ${open_iot_sdk_SOURCE_DIR}/components/TF-M)
list(APPEND CMAKE_MODULE_PATH ${open_iot_sdk_SOURCE_DIR}/cmake)
# Configuration of executable
# Configuration of executable
set(EXE_SUFFIX ".axf")
set(CMAKE_EXECUTABLE_SUFFIX ${EXE_SUFFIX})
# Include modules from the SDK
# Include modules from the SDK
include(ElfToBin)
include(TfmSignImage)
# Test management
include(CTest)
# Patch the FreeRTOS target to match config requirements
target_include_directories(freertos-kernel
INTERFACE
# Patch the FreeRTOS target to match config requirements
target_include_directories(freertos-kernel
INTERFACE
${PRJ_DIR}/bsp/aws_configs
${PRJ_DIR}/bsp/freertos-platform
${PRJ_DIR}/kws/include
${PRJ_DIR}/kws/include
)
# Compilation Database
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_custom_target(database COMMAND ${CMAKE_COMMAND} -E copy_if_different "${INT_DIR}/compile_commands.json" "${CMAKE_BINARY_DIR}")
# handle libraries
set(MQTT_CONFIG_PATH ${PRJ_DIR}/bsp/aws_configs)
set(HTTP_CONFIG_PATH ${PRJ_DIR}/bsp/aws_configs)
......@@ -112,7 +112,7 @@ set(CMAKE_EXECUTABLE_SUFFIX ${EXE_SUFFIX})
add_subdirectory(kws)
add_subdirectory(blinky)
# Copy tf-m binaries at the root
# Copy tf-m binaries at the root
ExternalProject_Get_Property(tf-m BINARY_DIR)
ExternalProject_Get_Property(tf-m SOURCE_DIR)
add_custom_target(tfm-binaries
......@@ -120,7 +120,7 @@ add_custom_target(tfm-binaries
${CMAKE_BINARY_DIR}/bootloader/bl2.axf
${CMAKE_BINARY_DIR}/secure_partition/tfm_s.axf
${CMAKE_BINARY_DIR}/secure_partition/tfm_s_unsigned.bin
${CMAKE_BINARY_DIR}/secure_partition/tfm_s_signed.bin
${CMAKE_BINARY_DIR}/secure_partition/tfm_s_signed.bin
COMMAND ${CMAKE_COMMAND} -E copy
${BINARY_DIR}/install/outputs/$<UPPER_CASE:"EXTERNAL/${TFM_PLATFORM_LOCAL_PATH}">/bl2.axf
......@@ -128,9 +128,9 @@ add_custom_target(tfm-binaries
COMMAND ${CMAKE_COMMAND} -E copy
${BINARY_DIR}/install/outputs/$<UPPER_CASE:"EXTERNAL/${TFM_PLATFORM_LOCAL_PATH}">/tfm_s.axf
"${CMAKE_CURRENT_BINARY_DIR}/secure_partition/tfm_s.axf"
"${CMAKE_CURRENT_BINARY_DIR}/secure_partition/tfm_s.axf"
COMMAND
COMMAND
${ARM_ELF2BIN} --bin --output ${CMAKE_BINARY_DIR}/secure_partition/tfm_s_unsigned.bin ${CMAKE_BINARY_DIR}/secure_partition/tfm_s.axf --bincombined
COMMAND
......
# Introduction
[Arm IoT Total Solutions](https://www.arm.com/solutions/iot/total-solutions-iot) provides a complete solution designed for specific use-cases, leaving developers to focus on what really matters – innovation and differentiation across diverse and varied use cases. It has everything needed to simplify the design process and streamline product development, including hardware IP, software, real-time OS support, machine learning (ML) models, advanced tools such as the new Arm Virtual Hardware, application specific reference code and support from the world’s largest IoT ecosystem.
[Arm IoT Total Solutions](https://www.arm.com/solutions/iot/total-solutions-iot) provides a complete solution designed for specific use-cases, leaving developers to focus on what really matters – innovation and differentiation across diverse and varied use cases. It has everything needed to simplify the design process and streamline product development, including hardware IP, software, real-time OS support, machine learning (ML) models, advanced tools such as the new Arm Virtual Hardware, application specific reference code and support from the world’s largest IoT ecosystem.
# Overview
This repo contains Arm's first [IoT Total Solution](https://www.arm.com/solutions/iot/total-solutions-iot), "Keyword Detection". It provides general-purpose compute and ML workload use-cases, including an ML-based keyword recognition example that leverages the DS-CNN model from the [Arm Model Zoo](https://github.com/ARM-software/ML-zoo).
This repo contains Arm's first [IoT Total Solution](https://www.arm.com/solutions/iot/total-solutions-iot), "Keyword Detection". It provides general-purpose compute and ML workload use-cases, including an ML-based keyword recognition example that leverages the DS-CNN model from the [Arm Model Zoo](https://github.com/ARM-software/ML-zoo).
The software supports multiple configurations of the Arm Corstone™-300 subsystem, incorporating the Cortex-M55 processor and Arm Ethos™-U55 microNPU. This total solution provides the complex, non differentiated secure platform software on behalf of the ecosystem, thus enabling you to focus on your next killer app.
The software supports multiple configurations of the Arm Corstone™-300 subsystem, incorporating the Cortex-M55 processor and Arm Ethos™-U55 microNPU. This total solution provides the complex, non differentiated secure platform software on behalf of the ecosystem, thus enabling you to focus on your next killer app.
## Keyword detection application
## Keyword detection application
The keyword detection application runs the DS-CNN model on top of [AWS FreeRTOS](https://docs.aws.amazon.com/freertos/). It detects keywords and inform the user of which keyword has been spotted. The audio data to process are injected at run time using the [Arm Virtual Hardware](https://www.arm.com/virtual-hardware) audio driver.
The keyword detection application runs the DS-CNN model on top of [AWS FreeRTOS](https://docs.aws.amazon.com/freertos/). It detects keywords and inform the user of which keyword has been spotted. The audio data to process are injected at run time using the [Arm Virtual Hardware](https://www.arm.com/virtual-hardware) audio driver.
The Keyword application connects to [AWS IoT](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) cloud to publish recognised keywords. AWS IoT cloud is also used for OTA firmware updates. These firmware updates are securely applied using [Trusted Firmware-M](https://tf-m-user-guide.trustedfirmware.org/). For more information, refer to the keyword detection [Readme](./kws/README.md).
![Key word detection architecture overview](./resources/Keyword-detection-overview.png)
## Blinky application
## Blinky application
The blinky application demonstrate blinking LEDs using Arm Virtual Hardware. AWS FreeRTOS and FreeRTOS are already included in the application to kickstart new developments.
The blinky application demonstrate blinking LEDs using Arm Virtual Hardware. AWS FreeRTOS and FreeRTOS are already included in the application to kickstart new developments.
# Quick Start
......@@ -32,14 +32,14 @@ To utilize the Arm Virtual Hardware, you will need to create an [AWS Account](ht
#### Launching the instance in EC2 [(AWS on getting started)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html)
1. Go to [EC2](https://console.aws.amazon.com/ec2/v2/) in the AWS Web Console.
1. Select **Launch Instances** which will take you to a wizard for launching the instance.
1. **Step 1: Choose an [Amazon Machine Image (AMI)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)** - In the Search box, type `Arm Virtual Hardware` then find the item called "Arm Virtual Hardware" that is by Arm, and press Select for that item. This image contains all the software necessary to build and run the Arm IoT Total Solutions.
This will raise a subscription page/pop-up titled, **Arm Virtual Hardware**. You will note that the subscription is free from Arm, but AWS does charge for the costs of the instances themselves according to the pricing chart provided.
This will raise a subscription page/pop-up titled, **Arm Virtual Hardware**. You will note that the subscription is free from Arm, but AWS does charge for the costs of the instances themselves according to the pricing chart provided.
> Arm Virtual Hardware for Corstone-300 is available as a public beta on AWS Marketplace. To help you get started, AWS are offering more than 100 hours of free AWS EC2 CPU credits for the first 1,000 qualified users. Click here to find out more: https://www.arm.com/company/contact-us/virtual-hardware.
You must select Continue if you want to move forward.
1. **Step 2: Choose an Instance Type** - Select one of the instance types from the list. We recommend the **c5.large**. Keep in mind that there are charges that accrue while the instance is running.
From here you may select **Review and Launch** to move directly to the launch page or select **Next: Configure Instance Details** if you need to set any custom settings for this instance.
......@@ -48,22 +48,22 @@ Once you complete the wizard by initiating the instance launch you will see a pa
Whichever way you choose find your new instance and select its instance ID to open the page to manage the instance.
#### Connecting to the instance:
#### Connecting to the instance:
1. Select **Connect** to open an SSH terminal session to the instance in your browser.
1. Ensure the User name field is set to `ubuntu`.
1. Select the **Connect** button to open the session. This will put you in a browser window where you will have an SSH terminal window ready for your input.
### Launch Using a local terminal
1. Install [AWS CLI 2](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) on your machine.
1. Install [AWS CLI 2](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) on your machine.
2. [Configure](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html) the access key, secret key and region that AWS CLI will use. If your organization uses AWS Single Sign-On, the [configuration process](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html) is slightly different. Make sure the region selected matches the region of the SSO service.
3. Create a new key pair.
3. Create a new key pair.
```sh
aws ec2 create-key-pair --key-name MyKeyPair
```
4. When AWS CLI display the new key pair. Save the key material in a `.pem` file. The file permission must be set to `400`.
4. When AWS CLI display the new key pair. Save the key material in a `.pem` file. The file permission must be set to `400`.
```sh
chmod 400 MyKeyPair.pem
......@@ -83,7 +83,7 @@ chmod 400 MyKeyPair.pem
./scripts/vht_cli.py -k MyKeyPair status
```
2. Connect to the instance using SSH and the private key saved localy.
2. Connect to the instance using SSH and the private key saved localy.
```sh
ssh -i "MyKeyPair.pem" ubuntu@<instance ip address>
......@@ -91,8 +91,8 @@ ssh -i "MyKeyPair.pem" ubuntu@<instance ip address>
## Build and execute the application
To update the application, a set of scripts is included to setup the environment,
build applications, run them and test them. These scripts must be executed in the AVH AMI.
To update the application, a set of scripts is included to setup the environment,
build applications, run them and test them. These scripts must be executed in the AVH AMI.
Open your favorite terminal program or linux shell application and connect to the AVH AMI instance:
......@@ -100,7 +100,7 @@ Open your favorite terminal program or linux shell application and connect to th
ssh ubuntu@<your-ec2-instance>
```
Clone the repository in the AMI:
Clone the repository in the AMI:
```sh
git clone https://github.com/ARM-software/ATS-Keyword && cd ATS-Keyword
......@@ -145,13 +145,13 @@ To build, run and launch a test of the blinky application, replace `kws` by `bli
## Updating audio data
The audio data streamed into the Arm Virtual Hardware is read from the file `test.wav` located at the root of the repository. It can be replaced with another audio file with the following configuration:
- Format: PCM
The audio data streamed into the Arm Virtual Hardware is read from the file `test.wav` located at the root of the repository. It can be replaced with another audio file with the following configuration:
- Format: PCM
- Audio channels: Mono
- Sample rate: 16 bits
- Sample rate: 16kHz
- Sample rate: 16kHz
# Continuous integration setup
# Continuous integration setup
Step by step instructions on how to setup a continuous integration pipeline in GitHub are provided in a mirror of this repository located at https://github.com/ARM-software/ATS-Keyword.
......@@ -257,7 +257,7 @@ Upon completion of the build and sign process the signature string will be echoe
1. Go to [EC2](https://console.aws.amazon.com/ec2/v2/) in the AWS Web Console.
2. Select the instance to stop.
3. Click on `Instance state` and select `Stop Instance` in the drop down menu.
## Stopping the instance using a local terminal
```sh
......@@ -266,24 +266,24 @@ Upon completion of the build and sign process the signature string will be echoe
# Source code overview
- `bsp`: Arm Corstone™-300 subsystem platform code and AWS configurations.
- `bsp`: Arm Corstone™-300 subsystem platform code and AWS configurations.
- `lib`: Middleware used by IoT Total Solution.
- `lib/mcuboot`: MCUboot bootloader.
- `lib/tf-m`: Trusted Firmware M: [Platform Security Architecture](PSA) for Armv8-M.
- `lib/mbedcrypto`: Mbed TLS and PSA cryptographic APIs.
- `lib/ml-embedded-evaluation-kit`: Arm® ML embedded evaluation kitr Ethos NPU. It includes [TensorFlow](https://www.tensorflow.org/)
- `lib/ml-embedded-evaluation-kit`: Arm® ML embedded evaluation kitr Ethos NPU. It includes [TensorFlow](https://www.tensorflow.org/)
- `lib/amazon_freertos`: AWS FreeRTOS distribution.
- `libVHT`: Virtual streaming solution for Arm Virtual Hardware.
- `libVHT`: Virtual streaming solution for Arm Virtual Hardware.
- `blinky`: Blinky application.
- `blinky/main_ns.c`: Entry point of the blinky application
- `kws`: Keyword detection application.
- `kws/source/main_ns.c`: Entry point of the kws application.
- `kws/source/main_ns.c`: Entry point of the kws application.
- `kws/source/blinky_task.c`: Blinky/UX thread of the application.
- `kws/source/ml_interface.c`: Interface between the virtual streaming solution and tensor flow.
- `kws/source/ml_interface.c`: Interface between the virtual streaming solution and tensor flow.
# ML Model Replacement
All the ML models supported by the [ML Embedded Eval Kit](All the models supported ) are available to applications. The first step to use another module is to generate sources files from its labels and `.tflite` model.
All the ML models supported by the [ML Embedded Eval Kit](All the models supported ) are available to applications. The first step to use another module is to generate sources files from its labels and `.tflite` model.
```sh
# Enter the ml example repository
......@@ -299,28 +299,28 @@ mkdir -p $ML_GEN_INC
--labels_file resources/<model name>/labels/<label file>.txt \
--source_folder_path $ML_GEN_SRC \
--header_folder_path $ML_GEN_INC \
--output_file_name <model name>_labels
--output_file_name <model name>_labels
./resources_downloaded/env/bin/python3 scripts/py/gen_model_cpp.py \
--tflite_path resources_downloaded/<model name>/<model>.tflite \
--output_dir $ML_GEN_SRC
```
Models available are present in `./lib/ml-embedded-evaluation-kit/resources_downloaded`.
Pre-integrated source code is available from the `ML Embedded Eval Kit` and can be browsed from `./lib/ml-embedded-evaluation-kit/source/use_case`.
Pre-integrated source code is available from the `ML Embedded Eval Kit` and can be browsed from `./lib/ml-embedded-evaluation-kit/source/use_case`.
Integrating a new model means integrating its source code and requires update of the build files.
# ML Embedded Eval Kit
The Arm ML Embedded Evaluation Kit , is an open-source repository enabling users to quickly build and deploy embedded machine learning applications for Arm Cortex-M55 CPU and Arm Ethos-U55 NPU.
The Arm ML Embedded Evaluation Kit , is an open-source repository enabling users to quickly build and deploy embedded machine learning applications for Arm Cortex-M55 CPU and Arm Ethos-U55 NPU.
With ML Eval Kit you can run inferences on either a custom neural network on Ethos-U microNPU or using availble ML applications such as [Image classification](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/img_class.md), [Keyword spotting (KWS)](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/kws.md), [Automated Speech Recognition (ASR)](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/asr.md), [Anomaly Detection](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/ad.md), and [Person Detection](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/HEAD/docs/use_cases/visual_wake_word.md) all using Arm Fixed Virtual Platform (FVP) available in Arm Virtual Hardware.
With ML Eval Kit you can run inferences on either a custom neural network on Ethos-U microNPU or using availble ML applications such as [Image classification](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/img_class.md), [Keyword spotting (KWS)](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/kws.md), [Automated Speech Recognition (ASR)](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/asr.md), [Anomaly Detection](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/c930ad9dc189d831ac77f716df288f70178d4c10/docs/use_cases/ad.md), and [Person Detection](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/HEAD/docs/use_cases/visual_wake_word.md) all using Arm Fixed Virtual Platform (FVP) available in Arm Virtual Hardware.
# Known limitations
- Arm compiler 6 is the only compiler supported.
- Accuracy of the ML detection running alongside cloud connectivity depends on the performance of the EC2 instance used. We recommend to use at least a t3.medium instance.
- Arm Corstone™-300 subsystem simulation is not time accurate. Performances will differ depending on the performances of the host machine.
- Arm compiler 6 is the only compiler supported.
- Accuracy of the ML detection running alongside cloud connectivity depends on the performance of the EC2 instance used. We recommend to use at least a t3.medium instance.
- Arm Corstone™-300 subsystem simulation is not time accurate. Performances will differ depending on the performances of the host machine.
# Future Enhancements
......
......@@ -19,7 +19,7 @@ NAME="$(basename "$0")"
HERE="$(dirname "$0")"
SCRIPTS="$HERE/scripts"
function show_usage {
function show_usage {
cat <<EOF
Usage: $0 <command> [command options]
......
......@@ -3,26 +3,26 @@
cmake_minimum_required(VERSION 3.21)
# Declare the blinky executable
add_executable(blinky
# Declare the blinky executable
add_executable(blinky
"${PRJ_DIR}/blinky/freertos_adaptation.c"
"${PRJ_DIR}/blinky/main_ns.c"
)
target_link_libraries(blinky
startup
lib-bsp
lib-bsp
tfm-ns-interface-cmsis-rtos
freertos-kernel-heap-4
freertos-kernel-heap-4
mcu-driver-hal
cmsis-rtos-api
freertos-cmsis-rtos
freertos-kernel
freertos-kernel
)
# Copy the result of TF-M build in the top level build directory
# Convert axf files into bin
# Sign binaries
# Copy the result of TF-M build in the top level build directory
# Convert axf files into bin
# Sign binaries
ExternalProject_Get_Property(tf-m BINARY_DIR)
ExternalProject_Get_Property(tf-m SOURCE_DIR)
add_custom_command(
......@@ -36,7 +36,7 @@ add_custom_command(
${CMAKE_CURRENT_BINARY_DIR}/blinky_unsigned.bin
${CMAKE_CURRENT_BINARY_DIR}/blinky_signed.bin
COMMAND
COMMAND
${ARM_ELF2BIN} --bin --output ${CMAKE_CURRENT_BINARY_DIR}/blinky_unsigned.bin ${CMAKE_CURRENT_BINARY_DIR}/blinky.axf --bincombined
COMMAND
......
......@@ -18,22 +18,25 @@
#include "stdio.h"
#include "task.h"
void vApplicationStackOverflowHook( TaskHandle_t xTask, char * pcTaskName )
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName)
{
printf("ERROR: Stack Overflow in task: %s", pcTaskName);
while(1);
while (1)
;
}
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer,
StackType_t **ppxIdleTaskStackBuffer,
uint32_t *pulIdleTaskStackSize)
{
/* If the buffers to be provided to the Idle task are declared inside this
function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
static StaticTask_t xIdleTaskTCB;
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
static StackType_t uxIdleTaskStack[configMINIMAL_STACK_SIZE];
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
state will be stored. */
......@@ -52,13 +55,15 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackTy
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )
void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer,
StackType_t **ppxTimerTaskStackBuffer,
uint32_t *pulTimerTaskStackSize)
{
/* If the buffers to be provided to the Timer task are declared inside this
function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
static StaticTask_t xTimerTaskTCB;
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
static StackType_t uxTimerTaskStack[configTIMER_TASK_STACK_DEPTH];
/* Pass out a pointer to the StaticTask_t structure in which the Timer
task's state will be stored. */
......@@ -72,4 +77,3 @@ void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, Stack
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}
......@@ -32,18 +32,18 @@
* Semihosting can be disabled by defining __ARM_use_no_argv symbol
* (or using higher optimization level).
*/
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
__asm(" .global __ARM_use_no_argv\n");
#endif
extern uint32_t tfm_ns_interface_init(void);
uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
uint8_t ucHeap[configTOTAL_HEAP_SIZE];
/*
* Main task to run TFM and ethernet communication testing
*/
static void blink_task( void *pvParameters )
static void blink_task(void *pvParameters)
{
uint32_t *fpgaio_leds = (uint32_t *)0x49302000;
const TickType_t xDelay = portTICK_PERIOD_MS * 200;
......@@ -64,14 +64,13 @@ int main()
tfm_ns_interface_init();
bsp_serial_init();
xTaskCreate(blink_task, "test task", configMINIMAL_STACK_SIZE*2, NULL, configMAX_PRIORITIES-2, NULL);
xTaskCreate(blink_task, "test task", configMINIMAL_STACK_SIZE * 2, NULL, configMAX_PRIORITIES - 2, NULL);
/* Start the scheduler itself. */
vTaskStartScheduler();
printf("End of main. Halting!\r\n");
while (1)
{
while (1) {
}
}
......
......@@ -21,7 +21,7 @@ target_include_directories(${LIB_NAME}
${PRJ_DIR}/kws/ota/provision
${PRJ_DIR}/lib/tf-m
${PRJ_DIR}/lib/tf-m/interface/include
${PRJ_DIR}/lib/tf-m/interface/include/psa
${PRJ_DIR}/lib/tf-m/interface/include/psa
${PRJ_DIR}/lib/tf-m/platform/ext
${PRJ_DIR}/lib/tf-m/platform/ext/cmsis
${PRJ_DIR}/lib/tf-m/platform/ext/common
......@@ -96,7 +96,7 @@ target_sources(${LIB_NAME}
)
target_link_libraries(${LIB_NAME}
PRIVATE
PRIVATE
FreeRTOS-Plus-TCP
freertos-kernel
tfm-ns-interface
......@@ -134,7 +134,7 @@ target_compile_definitions(${LIB_NAME}
-DTFM_SYSTEM_FP_NS=2
)
# BSP serial library
# BSP serial library
add_library(bsp_serial STATIC)
......@@ -148,7 +148,7 @@ target_include_directories(bsp_serial
${PRJ_DIR}/bsp/freertos-platform
)
target_link_libraries(bsp_serial
target_link_libraries(bsp_serial
PRIVATE
mcu-driver-hal
)
......@@ -179,8 +179,8 @@ target_compile_options(${LIB_NAME}
-std=c11
)
# Add Startup library
add_library(startup
# Add Startup library
add_library(startup
"${TFM_PLATFORM}/device/source/startup_an547_ns.c"
)
......@@ -192,7 +192,7 @@ target_include_directories(startup
"${SOURCE_DIR}/platform/include"
)
target_link_libraries(startup
target_link_libraries(startup
PUBLIC
tfm-ns-interface
mcu-driver-hal
......
......@@ -20,18 +20,18 @@ LR_CODE (0x28000000 + ((((0) + (0x60000)) + (0x400)))) {
* (InRoot$$Sections)
* (+RO)
}
ER_DATA 0x28700000 {
* (+ZI +RW)
}