ESP32 Demo project and AWS set up.

monkeytronics wrote on Saturday, June 15, 2019:

Hi, just starting out on my FreeRTOS journey. Went through the steps in AWS guide to get my ESP32-WROOM board running on freeRTOS. woring on windows. The demo program from espressif went thorugh fine. At this point, as per instructions, I had to remove the IDF_PATH variable, and move ahead through the AWS stuff. All looked good til the last step of running the demo: errors shown below. I haven’t touched a line of code, although I was promted to set several config settings: - some settings the verbosity of various reporting (0-7); multi blob support; support for mutex timed lock… The make script resumed after and failed when it tried to build aws-mqtt-agent. I really haven’t done anything at all except take it out of the box. Can anyone help me understand the reason it is failing to build. I read that the build normally shouldn’t have any warnings, so I’m assuming I not supposed to just change the settings to ignore warnings.

$ make
CC build/amazon-freertos-common/lib/mqtt/aws_mqtt_agent.o
In file included from C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c:47:0:
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c: In function 'prvSetupConnection':
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/include/aws_secure_sockets.h:339:37: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 #define socketsAWS_IOT_ALPN_MQTT    "x-amzn-mqtt-ca"
                                     ^
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c:859:27: note: in expansion of macro 'socketsAWS_IOT_ALPN_MQTT'
     char * ppcAlpns[] = { socketsAWS_IOT_ALPN_MQTT };
                           ^
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c: In function 'MQTT_AGENT_Init':
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c:1907:25: error: implicit declaration of function 'xQueueCreateStatic' [-Werror=implicit-function-declaration]
         xCommandQueue = xQueueCreateStatic( mqttCOMMAND_QUEUE_LENGTH, sizeof( MQTTEventData_t ), ucQueueStorageArea, &xStaticQueue );
                         ^
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c:1907:23: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
         xCommandQueue = xQueueCreateStatic( mqttCOMMAND_QUEUE_LENGTH, sizeof( MQTTEventData_t ), ucQueueStorageArea, &xStaticQueue );
                       ^
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c:1910:27: error: implicit declaration of function 'xTaskCreateStatic' [-Werror=implicit-function-declaration]
         xMQTTTaskHandle = xTaskCreateStatic( prvMQTTTask, "MQTT", mqttconfigMQTT_TASK_STACK_DEPTH, NULL, mqttconfigMQTT_TASK_PRIORITY, xStack, &xStaticTask );
                           ^
C:/Users/thebi/FreeRTOS/amazon-freertos/lib/mqtt/aws_mqtt_agent.c:1910:25: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
         xMQTTTaskHandle = xTaskCreateStatic( prvMQTTTask, "MQTT", mqttconfigMQTT_TASK_STACK_DEPTH, NULL, mqttconfigMQTT_TASK_PRIORITY, xStack, &xStaticTask );
                         ^
cc1.exe: some warnings being treated as errors
make[1]: *** [/c/Users/thebi/FreeRTOS/amazon-freertos/lib/third_party/mcu_vendor/espressif/esp-idf/make/component_wrapper.mk:286: lib/mqtt/aws_mqtt_agent.o] Error 1
make: *** [/c/Users/thebi/FreeRTOS/amazon-freertos/demos/espressif/esp32_devkitc_esp_wrover_kit/make/../../../../lib/third_party/mcu_vendor/espressif/esp-idf/make/project.mk:477: component-amazon-freertos-common-build] Error 2

rtel wrote on Saturday, June 15, 2019:

Sorry you are having these problems. To get you going I suggest you do
the following:

  1. Check configSUPPORT_STATIC_ALLOCATION is set to 1 in
    FreeRTOSConfig.h. - The nnnCreateStatic() functions won’t be available
    otherwise.

  2. Ensure FreeRTOS.h and then queue.h or tasks.h are included (as
    appropriate) at the top of the offending .c file.

You can also turn off the option that treats warnings as errors - just
so you can build.

Longer term, to ensure this is investigated and fixed, open an issue
here: https://github.com/aws/amazon-freertos/issues

monkeytronics wrote on Tuesday, June 18, 2019:

I think your static allocation suggestion was correct. In the menuconfig, I set
[*] Enable FreeRTOS static allocation API
and everything went straight through. Thanks a million. I’ll plough on now. My goal for this week is to get a comfortable IDE set up and running with a couple of tasks running, and hooking up to AWS over MQTT.

Went back to the AWS espressif getting started page today, and did a double take. Looks like they’ve completely rewritten the ESP32 build process to use CMake. Checked the update on the page header, and it’s dated last night! Which is great news I guess. Quite a bit of effort is clearly being channeled into getting it working. There’s even talk of this approach working well with VS Code. I also stumbled on Neil Kolban’s ESP32 on Eclipse demo on youtube, which is awesome. I’m not 100% the information he presents there can be used with the AWS FreeRTOS code. Although, at the same time, I can’t see why not…

With Amazon’s infinitly deep pockets, the huge popularity of the ESP devices, and the benefits that freeRTOS brings to embedded microprocessor design, I am confident that this is the future. So, I’ll stick with it!

alikhalil wrote on Tuesday, June 18, 2019:

Went back to the AWS espressif getting started page today, and did a double take. Looks like they’ve completely rewritten the ESP32 build process to use CMake. Checked the update on the page header, and it’s dated last night!

Hmm… I was having problems running make flash monitor 2 days ago and submitted the Did this page help you? feedback at the bottom of the page with a short description of my issue. Today I see that the page has been updated, and I can successfully run the demos.

Looks like the AWS team actually pays attention to submitted feedback! OR it’s just co-incidence.