Unexpected offset when using .rodata_custom_desc section
Posted: Fri Sep 19, 2025 11:41 am
Hi everyone,
I’m planning to use the .rodata_custom_desc dedicated memory section to store basic device information. The goal is to allow a third-party software to read the generated .bin and identify this information.
Following the Espressif official documentation, I implemented the following:
typedef struct custom_app {
const char *my_custom_text;
} esp_custom_app_desc_t;
const __attribute__((section(".rodata_custom_desc"))) esp_custom_app_desc_t custom_app_desc = {
.my_custom_text = "Hello World 123",
};
The custom_app_desc is placed in main.c just to speed up testing.
I also ensured that the following line is added to the CMakeLists.txt of main.c:
target_link_libraries(${COMPONENT_TARGET} "-u custom_app_desc")
Result:
I can find the "Hello World 123" string in the generated .bin file, but not at the offset expected according to the Espressif documentation.
Question:
Is there something wrong with my setup, or am I misunderstanding how the .rodata_custom_desc section should be used?
Any suggestions would be greatly appreciated.
IDF version: 5.3.1
I’m planning to use the .rodata_custom_desc dedicated memory section to store basic device information. The goal is to allow a third-party software to read the generated .bin and identify this information.
Following the Espressif official documentation, I implemented the following:
typedef struct custom_app {
const char *my_custom_text;
} esp_custom_app_desc_t;
const __attribute__((section(".rodata_custom_desc"))) esp_custom_app_desc_t custom_app_desc = {
.my_custom_text = "Hello World 123",
};
The custom_app_desc is placed in main.c just to speed up testing.
I also ensured that the following line is added to the CMakeLists.txt of main.c:
target_link_libraries(${COMPONENT_TARGET} "-u custom_app_desc")
Result:
I can find the "Hello World 123" string in the generated .bin file, but not at the offset expected according to the Espressif documentation.
Question:
Is there something wrong with my setup, or am I misunderstanding how the .rodata_custom_desc section should be used?
Any suggestions would be greatly appreciated.
IDF version: 5.3.1