Hi,
I have a custom booloder code. I want to check CRC of application code in bootloder.
I created section for my application and CRC result in the linker file.
MEMORY
{
GROUP(FLASH)
{
BEGIN : origin = 0x090000, length = 0x00000002
APPCODE : origin = 0x090002, length = 0xE000-0x80-0x02
} crc(linkerCrcRecord, algorithm=CRC32_PRIME)
CRC_TABLE : origin = 0x09DF80, length = 0x000080
}
SECTIONS
{
.TI.memcrc > CRC_TABLE
}
I am computing crc with this code in the bootloder.
MEMRANGE_CRC_TABLE *pLinkerCrcTable;
pLinkerCrcTable = (MEMRANGE_CRC_TABLE*)(0x09DF80);
uint32_t goldenCRC = pLinkerCrcTable->crc_value;
CRC_Obj CRC;
// \brief handle(pointer) to the CRC object
//
CRC_Handle handleCRC;
// \brief A single record(element) from the CRC table object
// Step 2: Initialize the CRC object
CRC.seedValue = INIT_CRC32;
CRC.nMsgBytes = 0xDF80;
CRC.parity = CRC_parity_even;
CRC.crcResult = 0;
CRC.pMsgBuffer = (uint32_t*)(void*)(0x090000U);
CRC.pCrcTable = NULL;
CRC.init = (void (*)(void *))CRC_init32Bit;
CRC.run = (void (*)(void *))CRC_run32BitPoly1;
// Step 3: Initialize the handle
handleCRC = &CRC;
// Step 2: Run the VCU 32-bit CRC routine and save the result
CRC.run(handleCRC);
// Compare calculated CRC and golden CRC.
if(goldenCRC != CRC.crcResult)
{
//does not match
}
Computed CRC and linker generated CRC does not match.
Where am I doing wrong?