Hi Denis
It shouldn't be necessary to use the CONFIG_CODE_DATA_RELOCATION configuration if what you need is to store some data at a specific location in flash.
Unfortunately there is no easy way to do this in Zephyr, but the fw_info module in the nrf repository is doing something similar in order to access data stored at a specific location in the flash.
The struct being stored is called m_firmware_info, and can be found in fw_info.c line 29.
In order for this to work you also need a custom linker script, in this case called fw_info.ld
And then you also need to use the zephyr_linker_sources Cmake function in CamekeLists.txt, shown here.
Could you try to do something similar?
Best regards
Torbjørn
Hi Torbjørn,
OK, thanks for looking into that. I am using a custom linker script now while I was trying to figure out if CONFIG_CODE_DATA_RELOCATION would work. The downside to the custom linker script is that I have to copy the one from Zephyr and just add one include at the right place for my customizations. So each Zephyr release, I'll have to revisit that linker script. Would be great if that linker script had config options for allowing the user to include their own snippets at various common places... (CONFIG_CODE_DATA_RELOCATION has config include at the same place in the linker script that I added my include. Maybe that include could be made more generic so that it can be used without CONFIG_CODE_DATA_RELOCATION.)