123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "Rom_check.h"
- #include "stm32f1xx_hal.h"
- #include "flash_if.h"
- #include "RefreshMenu.h"
- #include "crc.h"
- uint8_t RomCheck(void)
- {
- uint32_t index,crc_result;
- uint32_t romSize_byte,romSize_words;
-
- __HAL_CRC_DR_RESET(&hcrc);
- //romSize_byte = 0x35c0;
-
- romSize_byte = (downLoad.packageSize - 4);
- romSize_words = romSize_byte / 4;
-
- for(index = 0; index < romSize_words; index++)
- {
- CRC->DR = (*((uint32_t *)APPLICATION_ADDRESS + index));
- }
- crc_result = CRC->DR;
-
- if(crc_result != *(uint32_t *)(APPLICATION_ADDRESS + romSize_byte))
- {
- return ERROR;
- }
-
- return SUCCESS ;
- }
|