We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The reason I need the last byte of used memory is so that my application can compute a checksum value of ONLY the used flash memory.
I have considered just calculating the checksum over the entire flash memory, used and unused data, but I ran into a problem. The flash memory is spread over two different flash chips (Infineon XC161 internal flash) and an ST external flash chip. Both flash chips erase to different values. XC161 to $00 and ST to $FF. When I am computing the checksum from the *.bin file (created using hex2bin), the unused areas of flash image in the bin file are either $00 or $FF which means I cannot calculate the checksum accurately over the entire flash memory space.
After programming, the flash memory looks like this:
XX XX XX XX XX FF FF FF YY YY YY YY YY 00 00 00 Where XX is used data in the external flash FF is unused data in the external flash YY is used data in the internal flash 00 is unused data in the internal flash
And the bin file (created with hex2bin) looks like this: XX XX XX XX XX 00 00 00 YY YY YY YY YY 00 00 00
Notice the FF's are 00 in the bin file. I could set the fill byte to FF in which case the bin file would look like this: XX XX XX XX XX FF FF FF YY YY YY YY YY FF FF FF
But in both cases the bin file doe snot accurately represent what will be programmed into the flash memory. So any checksum calculated on the entire bin file will be incorrect.
I really need to calculate the checksum on ONLY the used bytes: XX XX XX XX XX and YY YY YY YY YY which means I need to know where the last used byte is in each flash memory area.
I have written my own hex2bin program that allows me to specify which fill character to use based on address ranges. However, I would prefer not to compute the checksum over the entire address range. I really would like to find a way to compute the checksum over only the used bytes.
I have seen this thread and others like it, that allow you to specify (LAST) for a segment address: http://www.keil.com/forum/docs/thread5659.asp I need something similar, but the (LAST) address specification that is shown in this thread does not seem to work within the XC161 linker.
Regards Paul
WHy recompie?
Can't you just generate the checksum in hex format, and concatenate that with the hex output from the linker. Then once more run the hex2bin process? Easy to automate and very quick.
I like that idea, but how do I get the Ulink programmer to automatically load the modified hex file into which I have programmed the checksum and length values? Especially when starting the Ulink debugger?