#include "bootloader.h" #include "can.h" #include "dwt.h" #include "global.h" #include "iap.h" #include "led.h" #include "queue.h" #include "system_stm32f4xx.h" #include extern SqQueue CanQueueImportant; // CAN重要数据队列 int main(void) { u16 cnt = 0; CanData_TypeDef element; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); DWT_Init(); LED_Init(); InitQueue(&CanQueueImportant); CAN2_Init(); while (1) { if (GetHead(&CanQueueImportant, &element) != ERROR) { cnt = 0; LED_RUN_ON(); iap_process(&element); } else if (flash_up_is_ok() == TRUE) { Iap_from_Flash(); boot_goto_app(APP_ADDRESS); } else { cnt++; bsp_DelayMS(10); if (cnt > 100) { boot_goto_app(APP_ADDRESS); } } } }