What is the STM32 Programmer CLI CRC calc polynomial?
Hey,
I went through the manual of the STM Programmer command line interface and implemented a post build CRC calc with the Safety lib command -sl.
C:\PROGRA~1\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe -sl MESOL_CAN_Gateway.elf 0x08000000 0x08100000 0x4000
In software then I ran a CRC calc with the standard settings of my STM32F767ZI, but unfortunately the values don´t agree. Does anybody know which polynomial the CLI uses or what I did wrong?
part of header file:
/* Public defines -----------------------------------------------------------*/
#define FLASH_BANK1_END 0x080FFFFF
#define PROG_FLASH_END 0x08007FFF // This might need to be extended if program grows, Remember to update AddCRC.bat
#define CRC_LOW_ADDR 0x080FFF00
#define CRC_HIGH_ADDR 0x080FFF04
#define CRC_SLICE_SIZE 0x4000
c file:
uint32_t CRCValueLow = 0x00000000;
uint32_t CRCValueHigh = 0x00000000;
uint32_t ExpectedCRCValueLow = 0x00000000;
uint32_t ExpectedCRCValueHigh = 0x00000000;
void CRCDiagnostics(void){
ExpectedCRCValueLow = *(uint32_t*)CRC_LOW_ADDR;
ExpectedCRCValueHigh = *(uint32_t*)CRC_HIGH_ADDR;
RCC->AHB1ENR |= RCC_AHB1ENR_CRCEN;
CRC->CR |= CRC_CR_RESET;
for(uint32_t *n = (uint32_t *)FLASH_BASE; n < (uint32_t *)(FLASH_BASE + CRC_SLICE_SIZE + 1); n ++)
{
CRC->DR = *n;
}
CRCValueLow = CRC->DR;
RCC->AHB1ENR |= RCC_AHB1ENR_CRCEN;
CRC->CR |= CRC_CR_RESET;
for(uint32_t *n = (uint32_t *)(FLASH_BASE + CRC_SLICE_SIZE + 1); n < (uint32_t *)(PROG_FLASH_END + 1); n ++)
{
CRC->DR = *n;
}
CRCValueHigh = CRC->DR;
return;
}
Thanks for the help!
Andre
