Topic : CRC value added

Forum : ST7/STM8

Original Post
Post Information Post
March 1, 2010 - 4:25pm
Guest

I need to CRC check our STM8L application on power up. I'm hoping that the linker can add a CRC value but I don't see any way to do this. Do I need to go to a third party or custom CRC generation tool to do this? Has anyone done this before.

I'm currently using the STM8L free tools.

Replies
Post Information Post
+1
0
-1
March 1, 2010 - 4:50pm
Guest

Obviously the CRC value will need to be stored in an area that is not part of the computation. I am using a CRC to verify EEPROM data in our STM8S is valid. My implementation is similar to the one at the URL below but uses only 8 bits and stores constant lookup table in code to save RAM and CPU time. However, the application does all of the calculation and verification (at run time).

http://www.lammertbies.nl/comm/info/crc-calculation.html

I have not yet tried to have the linker / toolchain automatically add this to the output file though. In another post I was told that Raisonance is hoping to release a new software version this month that will have better support for things like not erasing the EEPROM section during programming. Perhaps there will be more options for this as well.

In the mean time, what you might be able to do is locate a variable in non-volatile code or data space (Flash/EEPROM) and reference it in your code.

unsigned char at 0x4000 programmed_crc;

Then at build time, you could have a custom script run that generates the CRC and writes it to the fixed location in the output file. Or perhaps you could even copy and paste it with a hex editor, though that is less automated.

HTH

+1
0
-1
March 2, 2010 - 1:54pm
Guest

Hi

The improvement concerning memory space handlind is indeed to be done up on next release
which is still under test.

Here is the comment which will be added to the release note:

Quote:

. The STM8 debugger now offers session options: erase flash, program
flash, erase EEPROM, program EEPROM, program option bytes, activate
read-on-the-fly debugging, define debugger/core priority on memory
accesses.

Regards
Matloub

+1
0
-1
March 5, 2010 - 10:58am
Raisonance Support Team

Hi all,

JQ's idea is nice and simple, although it requires 2 builds to complete and cannot be automated.
As Matloub explained, this feature will be available in a future RKit-STM8 release (planned Q2 2010).

Regards,
Bruno