ULP linker Issues with Folder Structure
Posted: Fri Jul 11, 2025 6:27 pm
Hi all,
I’m working with ESP32-S3 and using ULP RISC-V. I'm using PlatformIO (which uses idf.py). I've encountered a couple of issues in the linker stage, which I cannot find any documentation on.
ulp_main.h Not Generated Unless ULP Source is Outside src/:
My project layout uses a src/ folder for all code. When I place ulp_main.c under src/ulp/ and define the source like this:
I get: fatal error: ulp_main.h: No such file or directory
I also tried placing ulp_main.c in include/ulp/ (outside src/) and referencing with:
Still fails with the same error, as the .h file is never generated.
Only when I place ulp_main.c in a sibling folder named ulp/ (next to src/) and reference it as:
ulp_main.h get generated and included properly.
This seems related to how treats paths. Is this a known constraint? Any way to put ulp/ inside src/ as I see in all the examples? What am I missing?
Another issue I am encountering is Link Errors When Calling Code from src/ subfolders in ULP:
I have some subfolders under src/ for implementing the sensors I am using. for example BPW34.
I want to call those function from ulp_main.c. When I inside ulp_main.c, compilation works, but I get undefined reference to adc_to_temperature
This is my src/CMakeLists.txt:
Is it possible to call my c file's function in src/ subfolders from ULP main function?
Thank you!
I’m working with ESP32-S3 and using ULP RISC-V. I'm using PlatformIO (which uses idf.py). I've encountered a couple of issues in the linker stage, which I cannot find any documentation on.
ulp_main.h Not Generated Unless ULP Source is Outside src/:
My project layout uses a src/ folder for all code. When I place ulp_main.c under src/ulp/ and define the source like this:
Code: Select all
set(ulp_sources "ulp/ulp_main.c")I also tried placing ulp_main.c in include/ulp/ (outside src/) and referencing with:
Code: Select all
set(ulp_sources "../include/ulp/ulp_main.c")Only when I place ulp_main.c in a sibling folder named ulp/ (next to src/) and reference it as:
Code: Select all
set(ulp_sources "../ulp/ulp_main.c")This seems related to how
Code: Select all
ulp_embed_binary()Another issue I am encountering is Link Errors When Calling Code from src/ subfolders in ULP:
I have some subfolders under src/ for implementing the sensors I am using. for example BPW34.
I want to call those function from ulp_main.c. When I
Code: Select all
#include "../src/bpw34/bpw34.h"This is my src/CMakeLists.txt:
Code: Select all
idf_component_register(SRCS
"lora_remote.cpp" "lora_common.cpp"
"lora/ra01s.c" "lora_receiver.cpp"
"oled/ssd1306.c" "oled/ssd1306_i2c_new.c"
"hdc2010/hdc2010.c" "bpw34/bpw34.c"
INCLUDE_DIRS "." "lora" "oled" "hdc2010" "bpw34"
REQUIRES soc nvs_flash ulp driver esp_adc)
# ULP build integration (must come AFTER idf_component_register)
set(ulp_app_name ulp_main)
set(ulp_sources "../ulp/ulp_main.c")
set(ulp_exp_dep_srcs "lora_remote.cpp")
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}")
Thank you!