Hi,
We need the ability to pad the end of our Zephyr application for 8 byte alignment. Is there a way to do this?
Thanks
Hi,
We need the ability to pad the end of our Zephyr application for 8 byte alignment. Is there a way to do this?
Thanks
Hi,
I think the partition manager could handle this for you: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/nrf/scripts/partition_manager/partition_manager.html
What is the use-case for your need to do this? DFU?
Hi Sigurd,
Our Zephyr application images are encrypted and require the end FLASH address to fall on an 8 byte boundary. We use our own custom non-Zephyr bootloader to decrypt the Zephyr application from SPIFLASH prior to programming into FLASH memory.
We use a custom linker script file to locate variables in certain sections of SRAM and FLASH memory. Is there a simple way to modify the alignment of code/data at the end of FLASH memory?
In the past, a simple ". = ALIGN(8);" statement in the linker script file will work to pad memory to an 8 byte alignment at the end of FLASH.
Thanks!
Hi,
I don't see any option in Zephyr to this. As far as I can see, it looks like it's set to align 4. https://github.com/zephyrproject-rtos/zephyr/blob/main/include/zephyr/arch/arm/aarch32/cortex_m/scripts/linker.ld#L146
But there could be some other ways to do it. Maybe you could check with the Zephyr community in the Zephyr discord. https://docs.zephyrproject.org/latest/develop/getting_started/index.html#asking-for-help
As you are already working with a custom linker script, maybe you can add a padding section at the end. Something like this:
.padding : ALIGN(8) { LONG(0xE015E015) } > FLASHThe LONG() is just a constant 4 byte word which will be added to the end of the FW image.
Thank you Vidar,
That did the trick! We actually pulled the Zephyr linker.ld script file local to our build and modified it to do the padding at the end of FLASH. See this link in the Zephyr project, https://github.com/zephyrproject-rtos/zephyr/commit/c107827bb7456d7ead8af0b1febe932e1b2c4423
Best,
Kurt