Building ESP32 ULP toolchain with AWS FreeRTOS

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)

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.

The versions of Amazon FreeRTOS and ESP-IDF are as follows:

  1. version of Amazon FreeRTOS repository used.202007.00 July 2020
    commit 36e1faf0b931dd8c78e32fc79df1a3f1718cb0c7 (HEAD → master, origin/master, origin/HEAD)
    Merge: c20c8f274 a35a407cc
    Author: Ravishankar Bhagavandas bhagavar@amazon.com
    Date: Wed Oct 7 16:40:42 2020 -0700
  2. Version of ESP-IDF:commit 29889b575e9f6f72aada23ab24d82d8d177498f0 (HEAD, origin/release/v3.3, origin/HEAD, release/v3.3)
    Author: Shubham Kulkarni shubham.kulkarni@espressif.com
    Date: Mon Jun 8 14:29:00 2020 +0530
  3. I am building my code within Amazon FreeRTOS in the following location:
    /vendors/espressif/boards/esp32/…

Kind Regards,

Rupan

I have also tried:

set(ULP_EXP_DEP_SRCS “${board_dir}/application_code/ulp_adc_example_main.c" "${board_dir}/application_code/params.c”)

Does the example based on the 202012.00 release I posted in the previous thread compile for you? There shouldn’t be much of a difference in that version to 202007.00, so I can attempt to backport it.

Carl

Hi Carl,

I will go through the thread carefully and do what is suggests and get back to you.

Cheers

Rupan

Hi Carl,

I have gone through the thread and the github repos that you have linked in there. I have now created a separate Cmakelist for the ULP files in the following location:

/vendors/espressif/boards/esp32/aws/demos/application_code/CmakeList.txt

The contents of this makelist are as follows:

set(COMPONENT_SRCDIRS “${board_dir}/application_code/”)
set(COMPONENT_ADD_INCLUDEDIRS “${board_dir}/application_code/”)
set(COMPONENT_REQUIRES unity ulp soc)
register_component()

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”)
ulp_embed_binary($(ULP_APP_NAME) “$(ULP_S_SOURCES)” “$(ULP_EXP_DEP_SRCS)”)

Note that my ULP files are in … application_code/ulp. I have also a CMakelist in the following location where I add my C files:

/vendors/espressif/boards/esp32/CMakeList.txt

This is very similar to the your Amazon freeRTOS Cmakelist in the same location. However I do not know how to link my new CMakeList.txt file that I used to for the ULP files into my build. I was wondering if you could review what I have done so far and tell me what the next steps are I would be very grateful.

Kind Regards,

Rupan

Hi @rupans,

I think it would be easier to follow the component pattern laid out by Espressif. I am not an expert on the IDF build system, and there may be some hidden magic that relies on their system.

Nevertheless, with the current approach should be able to include your CMakeLists.txt with the add_subdirectory() command.

Thanks,

Carl