Hello, I'm working on a 16bit microcontroller. I need to check for flash corruption. Flash is adressed at words (16bits). The linker calculate a CRC_CCITT and put the result in a cell of the flash.
The algorithm that the chip manufacurer gave us is painfully slow (it loops on every bits of the words):
size = FLASH_END_ADDR - FLASH_START_ADDR; //32kB in total segment_p = FLASH_START_ADDR; flash_CRC = 0xFFFF;
for ( ; size > 0; size-- ) { if ( segment_p != (uint16 *) FLASH_CRC_ADDR ) { uint16_t data = *segment_p;
for (uint16_t count = 16; count > 0; count-- ) { uint16_t xor_flag = (flash_CRC & 0x8000);
flash_CRC