2011-08-06 04:31 AM
Dear STM32 users,
I want to add a checksum to my application in such way I can every let's say 100 seconds check the flash integrity using CRC. I have found that IAR simplifies this task and can add at the final adress (or other specified locations) the CRC of the application. I refer to the techical note 11927 Checksum calculation with IELFTOOL after linking with ILINK http://supp.iar.com/Support/?note=11927&from=search+result and the provided examples: http://supp.iar.com/FilesPublic/SUPPORT/003588/Check_Sum_511.zip I am following the steps in this tech note and I stuck here:Add usage of the symbol __checksum in your application In fact I don't understand what does mean ''add usage of the symbol......'' When I declare it as following:unsigned short __checksum; I got thsi error message:Error[Li006]: duplicate definitions for ''__checksum''; in ''C:\.....\checksum\Obj\main.o'', and ''Place holder __checksum'' When I declare it as following as done in the example provided by IAR:extern unsigned short __checksum; I got this error message:ielftool error: The string '__checksum' was not found in the string table Is there someone who can help me on this? and thank you in advance.PS: I am using the IAR v6MCU Lüfter2011-08-08 01:26 AM
I have no experience with the IAR tools but if your output files are Intel hex it's easy to patch them with the CRC manually.
I think you should use a 32 bit checksum instead of a 16 bit which is really a bit short for the memory size of the STM32. There is a CRC unit in the STM32 that you can use. It's described in RM0008 section 3.2011-08-09 07:28 AM
Hi jan,
I will use crc 32-bit embedded in STM32 but now I am stuck how to generate the CRC using IAR v6. Any help is welcome.MCU Lüfter2011-08-09 09:47 AM
Here are the settings I used in IAR to get the checksum to match the STM32-generated one (note that your addresses will be different depending on your application):
Also see http://supp.iar.com/Support/?Note=119272011-08-09 12:39 PM
Hi benson,
In ''http://supp.iar.com/Support/?Note=11927'' I don't understand what does mean ''add usage of the symbol......'' When I declare it as following:unsigned short __checksum; I got thsi error message:Error[Li006]: duplicate definitions for ''__checksum''; in ''C:\.....\checksum\Obj\main.o'', and ''Place holder __checksum'' When I declare it as following as done in the example provided by IAR:extern unsigned short __checksum; I got this error message:ielftool error: The string '__checksum' was not found in the string table How did you get off of it? Thank you MCU Lüfter2011-08-09 01:54 PM
Make sure you add the __checksum symbol to the Input dialog as shown below:
I'm heading out for vacation now, so good luck :)2011-08-10 03:23 PM
Hi benson,
I am really thankfull for your help. Thanks again benson.MCU Lüfter