-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LPC checksum in .bin file #25
Comments
Thanks for pointing it out. Any idea what MCUs (or more generally CPUs) require this checksum? In the links I only found this line:
I tried to search for something similar where M0, M4 are mentioned, but to no avail. |
The original source https://www.nxp.com/docs/en/user-guide/UM10360.pdf (page 627) talks about this checksum in reference to "LPC176x/5x Flash memory interface and programming", further in OpenOCD when searching for checksum, it reaveals that there are reference to a flash checksum in lpc2xxx.cfg and lpc1xxx.cfg. Looking closer at what mbed-os does, it uses the When I read the first link correctly it states
So by that I read that as "every NXP LPC" part. |
Many thanks for the research. Added as a post action to the final binary image. |
Per this community topic (and related), the
.bin
file PlatformIO creates does not include the "LPC Image cheksum", as e.g. documented here. The first 7 entries of the vector table, interpreted as 4-byte little-endian integers, must be summed up (modulo 2^32), then the value~summed_value + 1
must be written at offset 0x1c.See
for code examples.
Without this checksum in the
.bin
file, if one takes that file and drag-and-drops it unto the virtual USB disk of the microcontroller for flashing, the firmware will refuse to run. It only works via OpenOCD flashing because OpenOCD detects that the checksum is missing and calculates and injects it last-minute before flashing.Code should be added into the build logic of this platform to calculate and write the checksum into all
.bin
files for NXP LPC microcontrollers.Note: This was already noticed in
#6 (comment)
But wasn't fixed in the platform code.
The text was updated successfully, but these errors were encountered: