Integrating modern ESP32 ULP toolchain with AWS FreeRTOS

Thanks Ian for confirming. Unfortunately, we do not support that MCU, and I would have to refer you to our Espressif colleague at their forums. . We currently do not stock that MCU to debug from our end.

Hi Ian,

Best way to test ULP and reset reason with AIthinker ESP32-S module would be to try running ULP example in ESP-IDF and check for the reset reason.
Please find the example at esp-idf/examples/system/ulp at master · espressif/esp-idf · GitHub

If the reset reason in ESP-IDF ULP example is ESP_RST_DEEPSLEEP, we can provide you further assistance with getting it fixed in AFR.

Thanks,
Shubham

I downloaded the pure Espressif ESP-IDF and compiled the example program you suggested. It does work. esp_get_idf_version reports v4.4-dev-479-g1067b2870.

Previously, I was using ESP-IDF v4.2-12-g3388b409c with the Amazon FreeRTOS. That was failing to wake because of the watchdog.

I checked out the esp-idf branch tagged as v4.2, and when I build this, the module also wakes up correctly. get_esp_idf_version reports v4.2.

In conclusion: my module correctly wakes with a pure esp-idf build of the example program. It does not wake correctly with the Amazon FreeRTOS ported esp-idf.

I think this conclusively shows I am not having a hardware issue. What are the next steps to solve this problem?

Hi,

I am also having very similar problems should I add to this thread or create another.

Kind Regards,

Rupan

Hello @icrowe,

Can you please try disabling CONFIG_ESP32_RTCDATA_IN_FAST_MEM from sdkconfig once and check:

idf.py menuconfig -> Component config -> ESP32-specific -> Enable RTC fast memory for dynamic allocations

I suspect this issue being same as TG0WDT_SYS_RESET upon waking up from deepsleep if FreeRTOS unicore is enabled (IDFGH-4116) · Issue #5983 · espressif/esp-idf · GitHub.

Thanks.

Hi,

I am currently trying to build and link my assembler files within ESP32 vendor code within the Amazon FreeRTOS platform.
I have followed the instructions by espressif and in the .rst files within Amazon FreeRTOS. However when I try to compile I get the following error logs:

– Building for target esp32
CMake Error at vendors/espressif/esp-idf/components/ulp/component_ulp_common.cmake:55 (add_dependencies):
add_dependencies called with incorrect number of arguments
Call Stack (most recent call first):
vendors/espressif/boards/esp32/CMakeLists.txt:397 (include)
CMakeLists.txt:70 (include)

CMake Error at vendors/espressif/esp-idf/components/ulp/component_ulp_common.cmake:58 (target_add_binary_data):
target_add_binary_data Function invoked with incorrect arguments for
function named: target_add_binary_data
Call Stack (most recent call first):
vendors/espressif/boards/esp32/CMakeLists.txt:397 (include)
CMakeLists.txt:70 (include)

The relevant code in the CMakeLists.txt file is as follows and i Have highlighted the error line below:

set(ULP_APP_NAME ulp_${COMPONENT_NAME})
set(ULP_S_SOURCES “${board_dir}/application_code/ulp/ulp_adc.S”)
set(ULP_EXP_DEP_SRCS “${board_dir}/application_code/ulp_adc_example_main.c ${board_dir}/application_code/params.c”)
include(${esp_idf_dir}/components/ulp/component_ulp_common.cmake) # <------- this line is the issue

The section of code from the component_ulp_common.cmake file is as follows:

add_dependencies(${COMPONENT_TARGET} ${ULP_APP_NAME}_artifacts)
target_linker_script(${COMPONENT_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ULP_APP_NAME}.ld)
target_add_binary_data(${COMPONENT_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ULP_APP_NAME}.bin BINARY)
endif()

I have also tried a solution with idf_component_register() and ulp_embed_binary() as per this thread and ULP example but when i do I get an unknown CMake command. Any ideas? Am I using the wrong version of Amazon FreeRTOS.
Any help would be greatly appreciated.

Kind Regards,

Rupan

Hello @mahavirj,

That change to sdkconfig allowed me to workaround the ULP not waking up on the AI-thinker module. You have solved my latest issue, thank you.

Is there any word on when this bug might be fixed?

Ian

Is there any word on when this bug might be fixed?

Please see linked issue in earlier comment at TG0WDT_SYS_RESET upon waking up from deepsleep if FreeRTOS unicore is enabled (IDFGH-4116) · Issue #5983 · espressif/esp-idf · GitHub. This has pointer to fix for our master branch.

  • This will be soon backported to previous release branch (in this case release/v4.2) and then it will reflect in next patch release, i.e. v4.2.1 for Amazon FreeRTOS context.
  • Alternatively you may try to cherry-pick fix manually, in case you face any problem, let me know, I can help to provide you with patch to unblock your development.

Thank you for pointing the solution out to me. If I had read the entire post about the issue, I could have answered for myself!

Ian

Hi Rupan,

Sorry I missed this post. Can you please create a new thread, and link to it here?

I believe the issue you are seeing is due to this line:
set(ULP_EXP_DEP_SRCS “${board_dir}/application_code/ulp_adc_example_main.c ${board_dir}/application_code/params.c”)

The files are not separated in two separate strings. Try doing the following, and see if it resolves your issue.
set(ULP_EXP_DEP_SRCS “${board_dir}/application_code/ulp_adc_example_main.c" "${board_dir}/application_code/params.c”)

Thanks,

Carl

I have tried as you have asked but with the same issue. The link to the new forum is as follows:

1 Like