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

A way to validate the hex file burned into device against the result (hex) of original source code

Engineerings, We are looking around to find a way to prove that the hex file burned into the device is really the result of the original source code. Is there any idea/way to validate?

How Nrfgo verify the program code burned into the device? I'm asking on program code hex structure.

  • Sure but that is already done by every flashing program if you use verify option (there is either tick-box or command line option) so why you want to do it again manually? Or you haven't checked that during flashing (or you want to check if someone haven't altered the FW later in the field)? Note that dumping the memory is not possible if the chip is locked (read-back protected) and who would ever ship unlocked chip? I'm really missing why are you doing all this...

  • We just want to do it as a proof of validation on the program code, showing that the compiled hex really contains the program code that is already running on the device.

  • Then you need to do it in two steps: firstly verify that flash content is equal to sequence of HEX files you applied during programming. As I said every normal person would use "verify" option in the flashing tool so this is done automatically without any effort needed. Second part is to validate that once you have certain source code base and compilation chain that it produces the HEX files which you loaded in previous step. But this is off-line procedure done on your PC (or other build system) and it has basically nothing to do with the HW. So simply show to whom ever you need that by compiling certain source code in certain way you have arrived to HEX binaries which are equal to these you flashed to the device. All done.

  • Base on the layout - do you know any way to detect the value of App size? I can't detect where application band ends and where free/swap area starts.

  • Well either your linker can print it in the end of compilation chain (if you don't see it that doesn't mean it cannot do it;) or simply look to the HEX file and read the header of each line so you can see what addresses are used. Or simply flash it to the chip and then dump and see where it sits (still involves understanding of Intel HEX format;) Or there might be some flashing tools which will tell you once you load the HEX to them before flashing (but I don't use any such tool so i cannot recommend). In every case understanding Intel HEX is so trivial that you can definitely start from there...

Related