I’ve been trying to integrate the ESP32 ULP compiler with AWS FreeRTOS LTS 202012.00 and ESP-IDF v4.2. My latest attempt followed the AWS Getting Started with the DevKitC and WROVER kit guide here: Getting started with the Espressif ESP32-DevKitC and the ESP-WROVER-KIT - FreeRTOS.
To integrate the ULP toolchain I followed the instructions from the ESP-IDF documentation here: ULP Coprocessor programming - ESP32 - — ESP-IDF Programming Guide v4.2 documentation. It is written such that a component is required to access the ULP. I generated a component following the example on the AWS Getting Started guide, but I am unable to get that component to link with the rest of the build.
To keep it simple, my component contains:
- a src directory with a c-file that loads the ULP binary
- an include directory with an h-file containing the function prototype for that function
- a single main.S file with the .global entry label and two simple instructions.
I strictly followed the AWS documentation for the component structure, although it is buried in a subdirectory of the project libraries directory.
When I build the project, the new include file is not visible to the rest of the project, even though COMPONENT_ADD_INCLUDEDIRS is correct. If I bypass that by using a full path to referenced h file, it still doesn’t generate an object file to link.
Because I have probably overlooked something simple, here are my changes to the CMakeFiles.txt files. This new stanza is inserted at line 18 of the main project CMakeLists.txt
message("identifying ulp component")
# add the test-ulp component
get_filename_component(
EXTRA_COMPONENT_DIRS
"libraries/tester/test-ulp" ABSOLUTE
)
list(APPEND IDF_EXTRA_COMPONENT_DIRS ${EXTRA_COMPONENT_DIRS})
This definitely gets parsed, the message is output during build.
Here is the component CMakeFiles.txt. The message is not output during the build, a further hint that I have not included the component properly.
message("setting up test-ulp component")
set(COMPONENT_ADD_INCLUDE_DIRS "include")
set(COMPONENT_SRCS src/test-ulp.c) #explicity list the sources
set(COMPONENT_REQURES ulp) #must be before register component
register_component()
set(ULP_APP_NAME "ulp_${COMPONENT_TARGET}")
set(ULP_S_SOURCES "ulp/main.S")
set(ULP_EXP_DEP_SRCS "../tester/src/ff_i2c2.c")
ulp_embed_binary(${ULP_APP_NAME} "${ULP_S_SOURCES}" "${ULP_EXP_DEP_SRCS}")
Lastly, in the library directory that contains our custom code, I required the new component in the CMakeLists.txt. (Perhaps this is wrong, our source code is a library, not a component)
#include the test-ulp component
set(COMPONENT_REQUIRES test-ulp)
Is there an example of successfully integrating the two toolchains and AWS FreeRTOS somewhere? Seeing a successfully structured project would be very useful, much more concrete than trying to correlate two independent howto guides.