Same code, compiles differently = bad checksum

Discussion created by FridgeFreezer on Jul 18, 2011
Latest reply on Jul 20, 2011 by FridgeFreezer

Just when I thought I'd nearly finished the project...


Using MCF52259, CW7.2, our own PCB based on the M52259EVB.


We have a serial bootloader which is quite similar to the Freescale USB bootloader example code, located at the bottom of flash after the vector table (0x00000420 - 0x00004000 is the reserved space). This then boots into our main() code. We use a checksum routine to verify the contents of flash RAM are good. The problem is that if we compile the project without making ANY changes to it, the compiled result is different (the S19 is different) from one day to the next, which makes the checksum incorrect if we upload the code part to another board which has yesterday's copy of the bootloader installed.


From the LCF:

vectorflash(RX) : ORIGIN = 0x00000000, LENGTH = 0x00000418bootcode    (RX): ORIGIN = 0x00000420, LENGTH = 0x00003BE0flash   (RX)   : ORIGIN = 0x00004010, LENGTH = 0x0007BFF0



This really gives rise to two questions:

1 - Is there some setting to make CW compile it the same way every time?

2 - As per how do I compile the bootloader separately and include it in the .lcf (I can't find any good info on how to properly include a block of compiled executable code so that the debugger is still happy etc.?)


All help gratefully appreciated as ever!


I'm sure I've seen at least a brief mention of how to include compiled code into the project somewhere round these forums but of course you can never find it when you need it!