MCU OTA升級流程
阿新 • • 發佈:2020-12-17
升級APP
升級Bootloader
CRC32原始碼計算
注: CRC-32使用MPEG_2多項式:0x04C11DB7
uint32_t uiCRC32_MPEG2(uint32_t *puiInitCRC, uint8_t *pucDataBuff, uint32_t uiLength)
{
uint32_t uiPolynomial = 0x04C11DB7, uiInputCRC = 0xFFFFFFFF, i = 0;
uint8_t ucMask = 0;
if(puiInitCRC != NULL)
uiInputCRC = *puiInitCRC;
for(i = 0; i < uiLength; ++i)
{
uiInputCRC ^= (uint32_t)(*pucDataBuff++) << 24;
for(ucMask = 1; ucMask; ucMask <<= 1)
{
if(uiInputCRC & 0x80000000)
uiInputCRC = (uiInputCRC << 1) ^ uiPolynomial;
else
uiInputCRC <<= 1;
}
}
return uiInputCRC;
}