1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

BL_HELPER: call CRC_Ini() from within CRC check function

This commit is contained in:
Corvus Corax 2011-04-23 20:55:21 +02:00
parent 0a05896146
commit 150464344d
3 changed files with 1 additions and 4 deletions

View File

@ -1230,7 +1230,6 @@ void firmwareiapobj_callback(AhrsObjHandle obj)
{
FirmwareIAPObjData firmwareIAPObj;
FirmwareIAPObjGet(&firmwareIAPObj);
CRC_Ini();
if(firmwareIAPObj.ArmReset==0)
reset_count=0;
if(firmwareIAPObj.ArmReset==1)
@ -1251,7 +1250,6 @@ void firmwareiapobj_callback(AhrsObjHandle obj)
else if(firmwareIAPObj.BoardType==BOARD_TYPE && firmwareIAPObj.crc!=FLASH_crc_memory_calc())
{
FLASH_read_description(firmwareIAPObj.Description,SIZE_OF_DESCRIPTION);
CRC_Ini();
firmwareIAPObj.crc=FLASH_crc_memory_calc();
firmwareIAPObj.BoardRevision=BOARD_REVISION;
FirmwareIAPObjSet(&firmwareIAPObj);

View File

@ -127,13 +127,11 @@ static void FirmwareIAPCallback(UAVObjEvent* ev)
this_time = get_time();
delta = this_time - last_time;
last_time = this_time;
CRC_Ini();
if((data.BoardType==BOARD_TYPE)&&(data.crc != FLASH_crc_memory_calc()))
{
FLASH_read_description(data.Description,FIRMWAREIAPOBJ_DESCRIPTION_NUMELEM);
PIOS_SYS_SerialNumberGetBinary(data.CPUSerial);
data.BoardRevision=BOARD_REVISION;
CRC_Ini();
data.crc = FLASH_crc_memory_calc();
FirmwareIAPObjSet( &data );
}

View File

@ -75,6 +75,7 @@ uint8_t FLASH_Start()
uint32_t FLASH_crc_memory_calc()
{
CRC_Ini();
CRC_ResetDR();
CRC_CalcBlockCRC((uint32_t *) START_OF_USER_CODE, (SIZE_OF_CODE) >> 2);
return CRC_GetCRC();