UL requires that we verify our software at runtime-- this means calculating the checksum of the section of memory that contains the program, and comparing it to a known value. Trouble is, including this known value anywhere in the source changes the resulting binary file/image in memory. A thread from 2003 (see bottom) suggests it’s possible to manually append a checksum to a .bin file, then access that value from within the program. This seems like my best bet, but there are a few problems:
I’d have to use the RFU to upload the .bin, which means no debugging (big minus)
It’s unclear how to calculate exactly where the appended value will end up in memory (prepending a ‘magic string’ to the value, then searching for that string, helps with this)
The value is difficult to obtain-- it must be recalculated every time the software is rebuilt, and I don’t know how to get it simply by looking at the .bin file. It seems to me I’d have to run the code on the Rabbit and have it spit out the correct checksum over the serial port, then append that value to the .bin file
Is there a better way? Perhaps the .bin file already has a checksum built into it. Is there some document that specifiest the format of the .bin? Any documentation on the final/intermediate output of the Rabbit compiler, or tools that can manipulate such, might be useful here.