diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 3413c569..8aceccf8 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -37,6 +37,7 @@ ECJPAKE ecdh ECDH ECKEY +endpointid fsanitize FVPs havege diff --git a/Config/aws_configs/aws_clientcredential.h b/Config/aws_configs/aws_clientcredential.h index bd9a10e4..3857a849 100644 --- a/Config/aws_configs/aws_clientcredential.h +++ b/Config/aws_configs/aws_clientcredential.h @@ -14,31 +14,24 @@ * * For AWS IoT MQTT broker, this is the Thing's REST API Endpoint. * - * @note Your AWS IoT Core endpoint can be found in the AWS IoT console under + * @note Replace the used dummy value "dummy.endpointid.amazonaws.com" by your + * AWS IoT Core endpoint which can be found in the AWS IoT console under * Settings/Custom Endpoint, or using the describe-endpoint REST API (with * AWS CLI command line tool). * */ -/* #define clientcredentialMQTT_BROKER_ENDPOINT "" */ - -#ifndef clientcredentialMQTT_BROKER_ENDPOINT - #error "Uncomment the clientcredentialMQTT_BROKER_ENDPOINT macro above and insert AWS IoT Core endpoint" -#endif /* clientcredentialMQTT_BROKER_ENDPOINT */ +#define clientcredentialMQTT_BROKER_ENDPOINT "dummy.endpointid.amazonaws.com" /** * @brief The MQTT client identifier used in this example. Each client identifier - * must be unique; so edit as required to ensure that no two clients connecting to - * the same broker use the same client identifier. + * must be unique; so replace the used dummy value "dummy_thingname" as required to + * ensure that no two clients connecting to the same broker use the same client identifier. * * Value is defined in "aws_clientcredential.h". */ -/* #define clientcredentialIOT_THING_NAME "" */ - -#ifndef clientcredentialIOT_THING_NAME - #error "Uncomment the clientcredentialIOT_THING_NAME macro above and insert MQTT client identifier" -#endif /* clientcredentialIOT_THING_NAME */ +#define clientcredentialIOT_THING_NAME "dummy_thingname" /** * @brief The port to use for the demo. diff --git a/Projects/aws-iot-example/main.c b/Projects/aws-iot-example/main.c index 9dfa214f..8b4c7a64 100644 --- a/Projects/aws-iot-example/main.c +++ b/Projects/aws-iot-example/main.c @@ -8,6 +8,7 @@ #include #include "app_config.h" +#include "aws_clientcredential.h" #include "dev_mode_key_provisioning.h" #include "mqtt_agent_task.h" @@ -61,6 +62,19 @@ extern BaseType_t xStartPubSubTasks( uint32_t ulNumPubsubTasks, extern uint32_t tfm_ns_interface_init( void ); +static bool xAreAwsCredentialsValid( void ) +{ + if( ( strcmp( clientcredentialMQTT_BROKER_ENDPOINT, "dummy.endpointid.amazonaws.com" ) == 0 ) || + ( strcmp( clientcredentialIOT_THING_NAME, "dummy_thingname" ) == 0 ) ) + { + printf( "[ERR] INVALID BROKER ENDPOINT AND/OR THING NAME.\r\n" ); + printf( "[ERR] Set the right credentials in aws_clientcredential.h\r\n" ); + return false; + } + + return true; +} + void vAssertCalled( const char * pcFile, unsigned long ulLine ) { @@ -151,6 +165,11 @@ int main() bsp_serial_init(); + if( xAreAwsCredentialsValid() != true ) + { + return EXIT_FAILURE; + } + /* Create logging task */ xLoggingTaskInitialize( appCONFIG_LOGGING_TASK_STACK_SIZE, appCONFIG_LOGGING_TASK_PRIORITY,