Add checksum to debugger image file

cancel
Showing results for 
Search instead for 
Did you mean: 

Add checksum to debugger image file

1,351 Views
iancull
Contributor II

With KDS Kinetis Design Studio (KE06Z processor) we've created a boot loader that verifies the main execution code with a checksum, before running it. However the tool that computes the checksum and adds it to the binary file, can't run till the linker has finished - and therefore the checksum cannot be in the linker output file that the debugger uses.

On KDS we have a solution using the "specify additional ELF file" feature which sets the debugger to load a checksum file in addition to the main (elf) debug code - see screenshot. I think I got this from Erich Styger / MCUonEclipse (but I can't find it there today).

We're planning to use MCUXpresso for our next project (KE18F processor) and it appears there is no similar feature to load additional files into the debugger image.

Has anyone got a solution for this problem? Either a way to force a checksum into the MCUXpresso debug (axf) file, or to get the debugger to load more than one file.

5 Replies

607 Views
lpcxpresso_supp
NXP Employee
NXP Employee

It ought to be possible to do something similar by adding a pre-launch command to the Debugger tab of the launch configuration editor to program the flash (which can either be a .bin or .axf). See section 14.2.1, "Editing a Launch Configuration" of the MCUXpresso IDE v10.0.0 User Guide.

The command to use can be manufactured by using the LinkServer GUI Flash Programmer - see section 10.5, "Using the LinkServer flash programmer" of the User Guide for more info on this.

Regards,

MCUXpresso IDE Support

607 Views
BlackNight
NXP Employee
NXP Employee

Hi Ian,

I'm using the exact same thing with the PEMicro interface in MCUXpresso v10 to add/program an extra CRC S19 file:

pastedImage_1.png

I hope this helps,

Erich

607 Views
iancull
Contributor II

Thanks, Erich ... so it seems that the PEMicro debug configuration allows additional files to be added, but the NXP debug configuration does not!

pastedImage_1.jpg

0 Kudos

607 Views
lpcxpresso_supp
NXP Employee
NXP Employee

There's no reason why you can't use your own utility in a post processing step to embed an image checksum at a pre-determined offset.

The LPC parts use a checksum word located at a specific offset in the vector table. This is simply a two's complement of the first 7 vector entries. The LPC boot loaders use this word to determine whether a valid user image exists before it loads the reset context. The LPC parts mostly use vector 7 (offset 0x1C), an unused vector location to store the checksum word. There were exceptions. If this is sufficient for your purposes, you'll find the checksum.exe utility in the MCUXpresso installation. Otherwise, it's a fairly trivial matter to write your own utility.

Thanks and regards,

LPCXpresso Support

255 Views
martin_due
Contributor II

Hi,

We would like to embed some additional information in the binary image.

LPC54605J256ET100.

We already post-process the binary and embed our own checksum at address 0x1C (Cortex-M4 MCU), but we would also like to embed the size of the image - to calculate the checksum in the secondary bootloader with the correct size.

Where should we do this? I can see in the Vector Table that 0x20 is for ECRP.

0x24 and 0x28 are reserved. Can we use those?

Or can we make additional entries in the end of the Vector Table itself? 

What is the standard way of doing this?

We could make our own header to the entire binary itself, but that seems a bit tedious...

 

Thx, Martin

 

 

 

 

 

 

0 Kudos