Hi!
I'm trying to do run 128kB of data through BGCRC( Flash bank. ). I'm not able to run all the data at once because it's in flash. I retrieve some of the data, run it through BGCRC and after the calculation is done I use the CRC result as the seed for the next calculation. Code composer checks if the BGCRC is idle before doing another calculation. The CRC I'm comparing to is calculated using SREC.
Also.. what CRC32 algorithm is BGCRC using?
SREC:
Fill 0xFFs srec_cat.exe %outputfolder%\%projname%_clean.S -fill 0xFF %AppStartAddress% %AppEndAddress% -o %outputfolder%\%projname%_temp.S -Output_Block_Size=%blocksize% Calculate checksum on filled hex file %btfolder%\SREC\srec_cat.exe %outputfolder%\%projname%_temp.S -crop %AppStartAddress% %AppEndAddress% -CRC32LE %AppCrcAddress% -o %outputfolder%\%projname%_temp.S -Motorola 8 -Output_Block_Size=64
CCS:
INT16U data[128] __attribute__ ((section(".BGCRC")));
//These are run in an init function:
BGCRC_setConfig(BGCRC_CPU_BASE, BGCRC_NMI_DISABLE, BGCRC_EMUCTRL_SOFT);
BGCRC_setRegion(BGCRC_CPU_BASE, (INT32U)&data, BGCRC_SIZE_BYTES_256, BGCRC_CRC_MODE);
void CheckFlashBankCRC(void)
{
static INT32U WordsLeft = 57344; // Number of words in 14 sectors.
static INT16U offset = 0;
static INT32U crc = 0;
INT32U receivedCrc = 0;
static BOOL crcFinished = FALSE;
// Check if BGCRC is finished with the previous calculation.
if((BGCRC_getRunStatus(BGCRC_CPU_BASE) == BGCRC_IDLE))
{
crc = BGCRC_getResult(BGCRC_CPU_BASE);
// Check if the crc is done.
if(crcFinished)
{
// Read the received CRC in the flash bank.
memcpy(receivedCrc, (INT32U*)(0x8DFFE + bankOffset), 2);
// Check if CRC is OK
if(receivedCrc == crc)
{
//Write revision
}
WordsLeft = 57344;
offset = 0;
crcFinished = FALSE;
}
else
{
BGCRC_setSeedValue(BGCRC_CPU_BASE, crc);
if(WordsLeft <= 128)
{
// Read 128 words from Flash to RAM
memcpy(data, (INT32U*)(0x80000 + bankOffset + offset), 128);
// Last two words is set to FFFF because they contain the received CRC
memset(data + 126, 0xFFFF, 2);
}
else
{
// Read 128 words from Flash to RAM
memcpy(data, (INT32U*)(0x80000 + bankOffset + offset), 128);
}
WordsLeft -= 128;
offset += 0x80;
if(WordsLeft <= 0)
{
crcFinished = TRUE;
}
BGCRC_start(BGCRC_CPU_BASE);
}
}
}