I build the application code for bank-1 using IAR. The hex output occupies (0x0008500~0x000AAEB6). Note that this is 155319 bytes (not page aligned to uint32--- one byte missing!).
This is confirmed with hex edit. One byte is missing.
When I generate bootloader settings using nrfutil.exe, it reports a size of 155320 bytes, even though the actual hex file is 155319 bytes.
I use the nRF Programmer tool to merge the hex files (MBR/SD, App, Bootloader, Bootloader Settings) and download using nrfjprog.exe.
When the debugger tries to copy firmware from bank1 to bank0, it checks the CRC using crc32_compute(). It uses the size field from the bootloader settings. This overruns the bank-1 firmware code, and grabs a bogus 0xFF as the last byte.
Debugger paused at the end of crc32_compute(). Last byte that is included in the calculation is 0xFF at 0x0004BEB7.
Programmer
Question
Is there a setting that will tell the IAR compiler to spit out a page aligned hex file? Is there also a bug in the nrfutil?
SDK15.0.0; SD140; nRF52840
IAR 8.50.9