Separating Unique Parameters from Firmware Binaries | Interrupt

When writing firmware for embedded systems, the firmware is usually meant to run on many identical devices. These devices often have their own serial number, public and private keys, or some other unique parameters. These parameters need to be provisioned per device, either by generating unique firmware binaries or by writing the values to the device’s persistent storage, like external flash or the EEPROM.


This is a companion discussion topic for the original entry at https://interrupt.memfault.com/blog/separating-unique-parameters
1 Like

Thanks, Amund of Interrupt. This came in the most appropriate time. Hope you wouldn’t mind me sharing this in Nordic DevZone.

Kind regards

1 Like

Thanks for sharing @Karlz! Note that another option for embedded a binary is to translate it into a header file. This is super easy with xxd -i . Check it out: https://unix.stackexchange.com/a/176112.

Hi Amund, this could not have come at a better time. I am trying to solve the exact same problem on my LoRaWAN devices as we are getting ready to scale. Lots of good input that I can put to use. We deploy our own private LoRaWAN network.

I’m happy to hear that you found this post useful!

hi all ,
could be merger(mergehex.exe tool )

Unique Parameter(A.hex) and App (B.hex)

i try to merger (A and B, mergehex -m A.hex B.hex -o C.hex)
ERROR: The hex files cannot be merged since there are conflicts

it seem write other program(python) to rebuild .like " Secure firmware updates with code signing"
or other ?

@stevenlin - Welcome to Interrupt! It sounds like your two files (A.hex and B.hex) have some overlapping regions. Make sure the addresses are distinct and they should merge fine.

1 Like

hi francois
in platform (nordic nrf52840,sdk 15.3)
i add the section(image_hdr) ,so it will be overlapping.
to use mergerhex to merger,not use nrfjprog (loadfile to change the [Unique Parameters)

nrf_common.ld
ENTRY(Reset_Handler)

SECTIONS
{
.text :
{
KEEP((.isr_vector))
KEEP (
(.image_hdr))
(.text)

}
}

@stevenlin upon digging some more, sounds like mergehex does not support this kid of operation. Instead, you might want to use this very good Python tool: https://python-intelhex.readthedocs.io/en/latest/part2-6.html

1 Like

hi francols,
very thank you for your tool.
i will try it .