This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

preparing a hex file to program in flash

Hello, I am using nrf52832 board, with SDK 11.0.0 and s132_nrf52_2.0.0. and trying to program a 512 Bytes text file using nrfjprog (J-Link: JLinkExe) in flash. The nrfjprog tool only allows a 4 Byte value write at a time to a an offset so I am trying to use the J-link loadfile command. I think I need to convert my 512 B text file to an Intel hex format and then use the mergehex to merge the file with softdevice and application hex files. However, I can't find clear instructions on how to convert my text file to hex as well as addresses to change before merging the 3 hex files. Would I need to manually create "records" for the Intel hex file? I am using Linux for development. Please advise on instructions to create the hex file, and tools to flash. Thanks.

Parents
  • Hi Sal, I don't think it would a simple way to convert a text file to binary/hex. You need to compile it or if it's simply data (or keys), you need to state the address it going to be.

    What I would suggest is to try to read the address you want to put the data in on the flash using nrfjprog. And then use any editor that can edit hex (notepad++ for example) and edit the hex file you get to the data you need, you then need to calculate CRC according to Intel Hex format. There is a CRC calculator here: www.fischl.de/.../

    Then you can use nrfjprog to flash it back to the chip.

Reply
  • Hi Sal, I don't think it would a simple way to convert a text file to binary/hex. You need to compile it or if it's simply data (or keys), you need to state the address it going to be.

    What I would suggest is to try to read the address you want to put the data in on the flash using nrfjprog. And then use any editor that can edit hex (notepad++ for example) and edit the hex file you get to the data you need, you then need to calculate CRC according to Intel Hex format. There is a CRC calculator here: www.fischl.de/.../

    Then you can use nrfjprog to flash it back to the chip.

Children
No Data
Related