From 6061e7dd57b42b55aa0f7de939a9546a76776298 Mon Sep 17 00:00:00 2001 From: Ahmed Ismail Date: Wed, 7 Feb 2024 16:20:37 +0000 Subject: [PATCH] keyword-detection: Add AWS Device Advisor validation This addition is used to validate that the applications's software conforms with TLS, MQTT, Device Shadow, and IoT Jobs best practices. Signed-off-by: Ahmed Ismail --- applications/keyword_detection/CMakeLists.txt | 1 + applications/keyword_detection/main.c | 27 ++++++++++++------- docs/project_organisation.md | 1 + ...nning_aws_iot_core_device_advisor_tests.md | 25 +++++------------ release_changes/202402131352.change | 3 +++ 5 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 release_changes/202402131352.change diff --git a/applications/keyword_detection/CMakeLists.txt b/applications/keyword_detection/CMakeLists.txt index cf06683b..cae79214 100644 --- a/applications/keyword_detection/CMakeLists.txt +++ b/applications/keyword_detection/CMakeLists.txt @@ -136,6 +136,7 @@ target_link_libraries(keyword-detection freertos_kernel freertos-ota-pal-psa fri-bsp + helpers-device-advisor helpers-events mbedtls mbedtls-threading-freertos diff --git a/applications/keyword_detection/main.c b/applications/keyword_detection/main.c index 365ee59a..53f812d0 100644 --- a/applications/keyword_detection/main.c +++ b/applications/keyword_detection/main.c @@ -1,4 +1,4 @@ -/* Copyright 2023 Arm Limited and/or its affiliates +/* Copyright 2023-2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: MIT */ @@ -12,6 +12,7 @@ #include "app_config.h" #include "aws_clientcredential.h" +#include "aws_device_advisor_task.h" #include "blink_task.h" #include "dev_mode_key_provisioning.h" #include "events.h" @@ -87,7 +88,9 @@ void vOtaActiveHook( void ) void vOtaNotActiveHook( void ) { - vMlTaskInferenceStart(); + #if ( appCONFIG_DEVICE_ADVISOR_TEST_ACTIVE == 0 ) + vMlTaskInferenceStart(); + #endif } void vAssertCalled( const char * pcFile, @@ -207,24 +210,30 @@ int main( void ) return EXIT_FAILURE; } - vStartMlMqttTask(); - vStartMqttAgentTask(); vStartOtaTask(); + + #if ( appCONFIG_DEVICE_ADVISOR_TEST_ACTIVE == 1 ) + vStartDeviceAdvisorTask(); + #else + vStartMlMqttTask(); + #endif } else { vMlTaskInferenceStart(); } - vStartBlinkTask(); + #if ( appCONFIG_DEVICE_ADVISOR_TEST_ACTIVE == 0 ) + vStartBlinkTask(); - #ifdef AUDIO_VSI - prvStartVsiCallbackTask(); - #endif + #ifdef AUDIO_VSI + prvStartVsiCallbackTask(); + #endif - vStartMlTask(); + vStartMlTask(); + #endif vTaskStartScheduler(); diff --git a/docs/project_organisation.md b/docs/project_organisation.md index d30375dd..33b143ac 100644 --- a/docs/project_organisation.md +++ b/docs/project_organisation.md @@ -246,6 +246,7 @@ target_link_libraries(keyword-detection freertos_kernel freertos-ota-pal-psa fri-bsp + helpers-device-advisor helpers-events kws_api kws_model diff --git a/docs/running_aws_iot_core_device_advisor_tests.md b/docs/running_aws_iot_core_device_advisor_tests.md index 0fa18889..73b201f4 100644 --- a/docs/running_aws_iot_core_device_advisor_tests.md +++ b/docs/running_aws_iot_core_device_advisor_tests.md @@ -59,34 +59,20 @@ user defines called out below. Save and close the file. - -Next insert the keys that are in the certificates you have downloaded when you -created the thing. Edit the file -`configs/aws_configs/aws_clientcredential_keys.h` replacing the existing keys -with yours. - -`keyCLIENT_CERTIFICATE_PEM` - -* Replace with contents from - `-certificate.pem.crt`. - -`keyCLIENT_PRIVATE_KEY_PEM` - -* Replace with contents from - `-private.pem.key`. - ## Building the application To build the application, run the following command: ```bash -./tools/scripts/build.sh ${APPLICATION_NAME} +./tools/scripts/build.sh ${APPLICATION_NAME} --certificate_path --private_key_path --target ``` +* The `certificate pem's path` and `private key pem's path` should be the downloaded key's and certificate's paths during the Thing creation. + Or, run the command below to perform a clean build: ```bash -./tools/scripts/build.sh ${APPLICATION_NAME} -c +./tools/scripts/build.sh ${APPLICATION_NAME} --certificate_path --private_key_path --target -c ``` ## Running the application @@ -108,3 +94,6 @@ IoT Core Qualification report by following the instructions in the [page](https: [creating-an-iot-thing-for-your-device]: ./setting_up_aws_connectivity.md#creating-an-iot-thing-for-your-device [creating-a-policy-and-attach-it-to-your-certificate]: ./setting_up_aws_connectivity.md#creating-a-policy-and-attach-it-to-your-certificate + +## Note +AWS IoT Core Device Advisor Tests are supported on `keyword-detection` application only. diff --git a/release_changes/202402131352.change b/release_changes/202402131352.change new file mode 100644 index 00000000..a32a747f --- /dev/null +++ b/release_changes/202402131352.change @@ -0,0 +1,3 @@ +aws-iot-example: Remove example. +ci: Build ML apps in Github Actions +keyword-detection: Add AWS Device Advisor validation.