#include "gd32f10x.h" #include "boot.h" #include "main.h" #include "delay.h" #include "fmc.h" #include "w25q32.h" #include #include "ota_message.h" #define APP_PROGRAMMER_BLOCK 2 //程序在W25Q32中存放的位置 load_a load_A; //进入bootloader更新 void BootLoader_Brance(uint32_t app_byte) { GD32_EraseFlash(GD32_A_START_PAGE,GD32_A_PAGE_NUM);//擦除A区原有程序 for(uint8_t i=0;i=0x20000000)&&(*(uint32_t *)addr<=0x20017FFF)){ MSR_SP(*(uint32_t *)addr); load_A = (load_a)*(uint32_t *)(addr+4); BootLoader_Clear(); load_A(); }else ; } /*-------------------------------------------------*/ /*函数名:清除B区使用的外设 */ /*参 数:无 */ /*返回值:无 */ /*-------------------------------------------------*/ void BootLoader_Clear(void) { gpio_deinit(GPIOA); gpio_deinit(GPIOB); }