Putting Archive file (.a) in RTC
Posted: Thu Apr 04, 2024 7:17 pm
We want to place a 3rd party archive (.a) in RTC memory to preserve the state of the library during deep sleep.
There are no state change issues in normal running or light sleep.
Our CMakeList.txt contains:
***
***
Our linker fragment file linker_fragment_file.lf contains:
*****
*****
The project will link as configured above and, as expected, there are references to the archive (lib_iaq_2nd_gen_ulp.a) in the RTC sections and other sections of the linker map output file (.map). The application executes but after wake up from deep sleep the library state is still lost.
However, we have not been able to link without the add_library(), set_property() and target_link_libraries() entries.
Therefore, we are concerned that the linker may not be resolving references using the archive loaded into the RTC, that there may be one unused version of the archive in RTC memory and a second version loaded and actually used by the linker to resolve references.
Please advise how to link with just the LDFRAGMENTS entry so that we are sure that the linker loads the archive into RTC memory and uses that RTC memory loaded archive to link and resolve references as appropriate.
Thanks.
There are no state change issues in normal running or light sleep.
Our CMakeList.txt contains:
***
Code: Select all
idf_component_register(SRCS "app_main.c"
"...other source files...c"
INCLUDE_DIRS "."
EMBED_TXTFILES server_root_cert.pem
esp_logo.png
howsmyssl_com_root_cert.pem
aol_root_cert.pem
postman_root_cert.pem
LDFRAGMENTS "linker_fragment_file.lf"
)
add_library(lib_iaq_2nd_gen_ulp STATIC IMPORTED GLOBAL)
set_property(TARGET lib_iaq_2nd_gen_ulp PROPERTY IMPORTED_LOCATION "${COMPONENT_DIR}/lib_iaq_2nd_gen_ulp.a")
target_link_libraries(${COMPONENT_TARGET} PUBLIC lib_iaq_2nd_gen_ulp)
Our linker fragment file linker_fragment_file.lf contains:
*****
Code: Select all
[mapping:main]
archive: lib_iaq_2nd_gen_ulp.a
entries:
* (rtc)
The project will link as configured above and, as expected, there are references to the archive (lib_iaq_2nd_gen_ulp.a) in the RTC sections and other sections of the linker map output file (.map). The application executes but after wake up from deep sleep the library state is still lost.
However, we have not been able to link without the add_library(), set_property() and target_link_libraries() entries.
Therefore, we are concerned that the linker may not be resolving references using the archive loaded into the RTC, that there may be one unused version of the archive in RTC memory and a second version loaded and actually used by the linker to resolve references.
Please advise how to link with just the LDFRAGMENTS entry so that we are sure that the linker loads the archive into RTC memory and uses that RTC memory loaded archive to link and resolve references as appropriate.
Thanks.