From a9ad3757b6ca650dfadd236a443168140eb6623c Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 12:02:01 -0400 Subject: [PATCH 1/7] bump freertos version --- IoT.csolution.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IoT.csolution.yml b/IoT.csolution.yml index 9e3e019..ce605d3 100644 --- a/IoT.csolution.yml +++ b/IoT.csolution.yml @@ -4,7 +4,7 @@ solution: packs: - pack: ARM::CMSIS - pack: ARM::CMSIS-Driver - - pack: ARM::CMSIS-FreeRTOS@10.4.6 + - pack: ARM::CMSIS-FreeRTOS@10.5.1 - pack: ARM::mbedTLS@1.7.0 - pack: AWS::backoffAlgorithm@1.0.0-Beta - pack: AWS::coreMQTT@1.1.0-Beta From 07c06f56d2a772dda34f9874c121c4af852571af Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 12:10:02 -0400 Subject: [PATCH 2/7] change run path --- run.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 95c34cc..889f963 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,10 @@ #!/bin/bash + +buildtype=Release +image=AWS_MQTT_PubSub_Demo.$buildtype+AVH_MPS3_Corstone-300.axf +target=./out/AWS_MQTT_PubSub_Demo/AVH_MPS3_Corstone-300/$buildtype/$image + VHT_MPS3_Corstone_SSE-300 -C mps3_board.visualisation.disable-visualisation=1 \ -C mps3_board.telnetterminal0.start_telnet=0 \ -C mps3_board.uart0.out_file=- \ --a mqtt_pub_sub/AWS_MQTT_PubSub_Demo.Release+AVH_MPS3_Corstone-300_OutDir/AWS_MQTT_PubSub_Demo.Release+AVH_MPS3_Corstone-300.axf +-a $target From 771a32e9200ffe4ea2046e362fa1fa5dc0cc235f Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 12:22:15 -0400 Subject: [PATCH 3/7] config all the credentials and config settings --- config.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 config.sh diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..48bb96b --- /dev/null +++ b/config.sh @@ -0,0 +1,56 @@ +#! /bin/bash + +d=$(dirname $0) +c=$d/credentials +p=$$ + +echo - Configure AWS API credentials +aws configure + +f_cred=$d/mqtt_pub_sub/config_files/aws_clientcredential_keys.h +f_config=$d/mqtt_pub_sub/config_files/demo_config.h + + +echo - Create thing credentials +key_prv=$c/thing.prv.$p.key +key_pub=$c/thing.pub.$p.key +crt_509=$c/thing.crt.$p.crt + +mkdir -p $c + +aws iot create-keys-and-certificate \ + --set-as-active \ + --certificate-pem-outfile $crt_509 \ + --public-key-outfile $key_pub \ + --private-key-outfile $key_prv > $c/certificate.$p.config + +sed -e 's/^/"/g' -e 's/$/\\n"\\/g' -e '$ s/.$//' $crt_509 > $crt_509.block +sed -e 's/^/"/g' -e 's/$/\\n"\\/g' -e '$ s/.$//' $key_prv > $key_prv.block + +sed -e 's/keyCLIENT_CERTIFICATE_PEM ""/keyCLIENT_CERTIFICATE_PEM/' \ + -e "/keyCLIENT_CERTIFICATE_PEM/r $crt_509.block" $f_cred | \ + sed -e ':a;N;$!ba;s/keyCLIENT_CERTIFICATE_PEM\n/keyCLIENT_CERTIFICATE_PEM /g' > \ + /tmp/k$p && mv -f /tmp/k$p $f_cred + +sed -e 's/keyCLIENT_PRIVATE_KEY_PEM ""/keyCLIENT_PRIVATE_KEY_PEM/' \ + -e "/keyCLIENT_PRIVATE_KEY_PEM/r $key_prv.block" $f_cred | \ + sed -e ':a;N;$!ba;s/keyCLIENT_PRIVATE_KEY_PEM\n/keyCLIENT_PRIVATE_KEY_PEM /g' > \ + /tmp/k$p && mv -f /tmp/k$p $f_cred + +clientid=$(hostname | sed -e 's/-//g')-$p +endpoint=$(aws iot describe-endpoint --endpoint-type iot:Data-ATS --output text) +certificate_arn=$(jq -r .certificateArn $d/credentials/certificate.$p.config) +certificate_id=$(jq -r .certificateId $d/credentials/certificate.$p.config) + +aws iot create-thing --thing-name $clientid > $c/thing.$p.config +aws iot attach-thing-principal \ + --thing-name $clientid \ + --principal $certificate_arn +aws iot attach-policy \ + --policy-name dev_policy \ + --target $certificate_arn + +sed -i -e "s/^#define democonfigCLIENT_IDENTIFIER.*/#define democonfigCLIENT_IDENTIFIER \"$clientid\"/" $f_config +sed -i -e "s/^\s#define democonfigMQTT_BROKER_ENDPOINT.*/#define democonfigMQTT_BROKER_ENDPOINT \"$endpoint\"/" $f_config + + From 0a6fd96014b96491bcfc20364ec59cca73bea683 Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 12:23:00 -0400 Subject: [PATCH 4/7] config MVE --- mqtt_pub_sub/RTE/RTOS/FreeRTOSConfig.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mqtt_pub_sub/RTE/RTOS/FreeRTOSConfig.h b/mqtt_pub_sub/RTE/RTOS/FreeRTOSConfig.h index 5670efa..a244e30 100644 --- a/mqtt_pub_sub/RTE/RTOS/FreeRTOSConfig.h +++ b/mqtt_pub_sub/RTE/RTOS/FreeRTOSConfig.h @@ -291,4 +291,5 @@ void vLoggingPrintf( const char * pcFormat, ... ); #define configHEAP_REGION0_ADDR 0 #define configHEAP_REGION0_SIZE 0x1E000 +#define configENABLE_MVE 1 #endif /* FREERTOS_CONFIG_H */ From a51b4b4a584f757f016c887a48408763ee29571c Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 12:49:04 -0400 Subject: [PATCH 5/7] change mechanism for understanding required packages --- install_cpacks.sh | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/install_cpacks.sh b/install_cpacks.sh index 6de56ab..1092a37 100644 --- a/install_cpacks.sh +++ b/install_cpacks.sh @@ -1,17 +1,9 @@ -#!/bin/bash -cpackget -q pack add -a ARM::CMSIS-Driver -cpackget -q pack add -a ARM::CMSIS-FreeRTOS@10.4.6 -cpackget -q pack add -a ARM::mbedTLS@1.7.0 -cpackget -q pack add -a AWS::backoffAlgorithm@1.0.0-Beta -cpackget -q pack add -a AWS::coreMQTT@1.1.0-Beta -cpackget -q pack add -a AWS::coreMQTT_Agent@1.0.1-Beta -cpackget -q pack add -a AWS::corePKCS11@3.0.0-Beta -cpackget -q pack add -a AWS::FreeRTOS-Plus-TCP@2.3.2-Beta -cpackget -q pack add -a Arm-Packs::PKCS11 -cpackget -q pack add -a MDK-Packs::IoT_Socket -cpackget -q pack add -a Keil::V2M-MPS2_CMx_BSP@1.8.0 -cpackget -q pack add -a ARM::V2M_MPS3_SSE_300_BSP@1.2.0 -cpackget -q pack add -a NXP::MIMXRT1052_DFP@13.1.0 -cpackget -q pack add -a NXP::EVKB-IMXRT1050_BSP@13.1.0 -cpackget -q pack add -a Keil::IMXRT1050-EVKB_BSP@1.0.0 -cpackget -q pack add -a Keil::iMXRT105x_MWP@1.4.0 +#! /bin/bash +d=$(basename $0) +c="cpackget -q pack add -a" +# Use the single source of truth to get packages +plist=$(grep pack: $d/IoT.csolution.yml | sed -e 's/\s//g' -e s'/-pack://g') + +for pkg in $plist; do + $c $pkg +done From 79b303da6ec56f98a19382041ac19abc6058f7a3 Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 14:21:56 -0400 Subject: [PATCH 6/7] wrong command for dirname --- install_cpacks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_cpacks.sh b/install_cpacks.sh index 1092a37..3826210 100644 --- a/install_cpacks.sh +++ b/install_cpacks.sh @@ -1,5 +1,5 @@ #! /bin/bash -d=$(basename $0) +d=$(dirname $0) c="cpackget -q pack add -a" # Use the single source of truth to get packages plist=$(grep pack: $d/IoT.csolution.yml | sed -e 's/\s//g' -e s'/-pack://g') From df5925038b0e131a996e4cf6d8d0bfb2cf0449f8 Mon Sep 17 00:00:00 2001 From: Richard Elberger Date: Mon, 24 Jul 2023 14:28:26 -0400 Subject: [PATCH 7/7] generated FreeRTOSConfig.h doesn't work, forcibly copy working one --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 9755707..99840a5 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,8 @@ case $1 in cbuild mqtt_pub_sub/AWS_MQTT_PubSub_Demo.Release+AVH_MPS3_Corstone-300.cprj -c ;; *) - csolution convert -s IoT.csolution.yml -c AWS_MQTT_PubSub_Demo.Release+AVH_MPS3_Corstone-300 + csolution convert -s IoT.csolution.yml -c AWS_MQTT_PubSub_Demo.Release+AVH_MPS3_Corstone-300 + cp mqtt_pub_sub/RTE/RTOS/FreeRTOSConfig.h RTE/RTOS/FreeRTOSConfig.h cbuild mqtt_pub_sub/AWS_MQTT_PubSub_Demo.Release+AVH_MPS3_Corstone-300.cprj ;; esac