Rich Bair

Checksum Help

Discussion created by Rich Bair on Nov 16, 2006
Latest reply on Dec 1, 2006 by Rich Bair
I'm trying to create a "firmware integrity" check by using the __CHECKSUM_IS_OK macro like the following:
 
Code:
    while (__CHECKSUM_IS_OK == FALSE) {        disp.dig[0] = '6';        disp.dig[1] = '0';        disp.dig[2] = 'R';        disp.dig[3] = 'E';        disp.led_q = 0x00;        disp.led_t = 0x00;        /* Keep machines running during delay! */        run_machine();    }

 
To test this, I use PROG12Z to corrupt (read change) the flash in a certain byte/word.  I then run verify to ensure it fails to ensure I've changed some flash.  My prm file is:
 
Code:
/* This is a linker parameter file for the MC9S12E128 */NAMESENDSECTIONS      /* List of all sections specified on the "Build options" tab */      RAM        = READ_WRITE 0x002000 TO 0x003FFF FILL 0xAA 0x55;   /* unbanked FLASH ROM */      ROM_FLASH  = READ_ONLY  0x3E8000 TO 0x3E83FF FILL 0x00 NO_CHECKSUM;      ROM_4400   = READ_ONLY  0x004400 TO 0x007FFF FILL 0x3F;      ROM_C000   = READ_ONLY  0x00C000 TO 0x00FEFF FILL 0x3F;   /* banked FLASH ROM */      PAGE_38    = READ_ONLY  0x388000 TO 0x38BFFF FILL 0x3F;      PAGE_39    = READ_ONLY  0x398000 TO 0x39BFFF FILL 0x3F;      PAGE_3A    = READ_ONLY  0x3A8000 TO 0x3ABFFF FILL 0x3F;      PAGE_3B    = READ_ONLY  0x3B8000 TO 0x3BBFFF FILL 0x3F;      PAGE_3C    = READ_ONLY  0x3C8000 TO 0x3CBFFF FILL 0x3F;      PAGE_3D    = READ_ONLY  0x3D8000 TO 0x3DBFFF FILL 0x3F;ENDPLACEMENT      SSTACK, DEFAULT_RAM             INTO RAM;      CHIMERA_FLASH                   INTO ROM_FLASH;      DEFAULT_ROM                     INTO ROM_4400, PAGE_3C, PAGE_3D, PAGE_38, PAGE_39, PAGE_3A, PAGE_3B;      RTOS, _PRESTART, STARTUP,      ROM_VAR, STRINGS,      NON_BANKED, COPY, .checksum     INTO ROM_C000;ENDINIT _EntryPoint   /* The entry point of the application. This function is generated into the CPU module. */STACKSIZE 0x0200

 
So I surmise the linker will check every used portion of flash (not 0x3A fill areas but actual code) except ROM_FLASH.  This never works!  I know the code is actually changing because I start to have erratic behavior so clearly I'm not understanding how the auto checksum calculation works.  Any ides/thoughts would be much appreciated!
 
Thanks!

Outcomes