I’m trying to build a zephyr project for teensy / IMXRT1060 and am setting CONFIG_FLASH=y for some ota dfu functionality and I’m getting an error:
*** [.pio/build/evkb/code_relocation_source_lib/zephyr/code_relocation.c.o] Source `.pio/build/evkb/zephyr/code_relocation.c' not found, needed by target `.pio/build/evkb/code_relocation_source_lib/zephyr/code_relocation.c.o'
So, I did some digging. When
CONFIG_FLASH is enabled then
CONFIG_CODE_DATA_RELOCATION gets enabled automatically. Once
CONFIG_CODE_DATA_RELOCATION is enabled it seems like CMakeLists.txt knows to generate the code relocation source files, library, and linker scripts (
target_relocation.cmake is included from root CMakeLists.txt). However the platformio toolchain is not aware of that project setting and doesn’t generate the required files.
I dug even more into
framework-zephyr/scripts/platformio/platformio-build.py and noticed that the build script manually generates many of the dependencies like offsets header, isr table, and many others. It seems to me like the code relocation generation is in the same category of things but it exists in CMakeLists but not in platformio-build.py.
This is where it got a bit too deep for me and I wasn’t able to figure out how to add the right call to
Can anyone more experienced with zephyr + pio integration help with this?