diff --git a/Project/GateWay/source/User/Inc/Public.h b/Project/GateWay/source/User/Inc/Public.h index c99a779..d2a1ae9 100644 --- a/Project/GateWay/source/User/Inc/Public.h +++ b/Project/GateWay/source/User/Inc/Public.h @@ -258,8 +258,6 @@ typedef struct { uint16_t LocalPort; //本地客户端端口(预留) }LTENetPara_t, *pLTENetPara; - - typedef struct { uint8_t IpMode; //IP模式:DHCP/静态 uint8_t IpAddr[4]; //本地IP地址 diff --git a/Project/GateWay/source/User/Inc/bsp.h b/Project/GateWay/source/User/Inc/bsp.h index b44ea73..d64274c 100644 --- a/Project/GateWay/source/User/Inc/bsp.h +++ b/Project/GateWay/source/User/Inc/bsp.h @@ -53,6 +53,7 @@ #define APP_START_FLAG 0x55AA5A5A #define APP_UPDATE_FLAG 0xA5A5AA55 +#define APP_BOOT_UPGRADE_FLAG 0x5A5A55A5 #define WATCH_DOG 1 diff --git a/Project/GateWay/source/User/Src/main.c b/Project/GateWay/source/User/Src/main.c index 63c8252..0b95a18 100644 --- a/Project/GateWay/source/User/Src/main.c +++ b/Project/GateWay/source/User/Src/main.c @@ -129,6 +129,15 @@ void GateWayInit(void) Debug_Printf("FlashID: %08x\r\n", FlashID); memset((uint8_t *)&GateWay.ConfigPara, 0x00, sizeof(GWConfigPara_t)); + boot_para_t bootParam; + dev_boot_read_param(&bootParam); + if(bootParam.AppFlag == APP_BOOT_UPGRADE_FLAG) { + rt_kprintf("Boot upgrade detected, erasing external Flash...\r\n"); + SpiFlashEraseChip(); + bootParam.AppFlag = 0; + dev_boot_write_param(bootParam); + } + int ret = ReadPara((uint8_t *)&GateWay.ConfigPara, sizeof(GWConfigPara_t)); if(GateWay.ConfigPara.SavFlag != LOG_SAV_FLAG) { memset((uint8_t *)&GateWay.ConfigPara, 0x00, sizeof(GWConfigPara_t));