Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Merged binary (.bin) of SoftDevice + application bricking devices, differs from the merged hex when flashed?

I'm attempting to generate a binary blob containing both the S140 SoftDevice (to be placed at address 0x1000 in flash) and the main application firmware (at 0x26000).

I use the following command to generate a merged hex: mergehex --merge ./main_app.hex ./s140.hex -o ./mergedapp.hex. This merged hex is flashed using JLinkExe or nrfjprog and the code executes as expected.

I use this command to generate a binary: arm-none-eabi-objcopy -I ihex -O binary ./mergedapp.hex ./mergedapp.bin, and then I flash it to my nRF52840 MCU using JLink Commander: loadbin mergedapp.bin 0x1000. This method doesn't seem to work, despite flashing the two binaries separately (at 0x1000 for the s140.bin and 0x26000 for the main_app.bin) and flashing the merged hex having worked properly. Using memrd, I noticed some key locations in flash such as 0x1000, 0x26000, etc differ when I flash the merged binary compared to the merged hex. 

I've also tried to pad the SoftDevice before merging by using --pad-to=0x26000 --gap-fill=0xFF, but the end result is still a nonfunctional program.

I've included some photos below of the device memory layout read using the Programmer tool. The first photo is from flashing the SoftDevice and application separately or flashing the merged hex (everything looks normal), and the second photo is from flashing the merged binary.

Parents Reply
  • To my knowledge this is incorrect. I have a MBR at 0x0, and it cannot be placed elsewhere. This is a mature project that has always had its SoftDevice placed at 0x1000. 

    Most of the information I’ve provided in the original post outlines what I tried that has and hasn’t worked. I do have a working solution for my use case (concatenating the binaries over CLI and piping the output into a separate file), but I’d like to figure out why a merged hex converted to a binary produces a different outcome than converting both individual hex files into binaries and flashing them separately. 

Children
Related