2 Replies Latest reply on Jan 4, 2018 6:43 AM by robert.giumarra_2378941

    Flash Checksum Calculation


      I am trying to verify the checksum of the programmed flash memory as part of a BIT test upon startup.  I am adding all the memory locations that are defined to be part of the flash memory.  The code is very straight forward:


      unsigned long CalculateFlashCSUM()


      unsigned long CheckSum=0;


          uint8 * FlashAddress;



          for(unsigned int i=0;i<=CYDEV_FLASH_SIZE;i++)


              CheckSum += *(FlashAddress++);


          return (CheckSum);



      I was hoping that I could associate this with something in the hex program file.  This would make it easier to update the software because I could then just inspect the hex file to determine the expected CheckSum value, but the Checksum I am getting from above doesn't seem to match anything in the hex file.  Can anyone provide any insight?  Currently, CheckSum is calculated to be 0x0023D6E0 using the above algorithm and the bottom of the hex file looks like this: