fix: boot升级后擦除外Flash防参数偏移,修复8项Bug
新增APP_BOOT_UPGRADE_FLAG标记,boot升级后APP启动时检测并擦除外部Flash避免参数偏移。修复: CatSendErrCnt清零、Mac索引、时间同步指针、HIS_DATA break、Ch2校准标志、RS485离线通知格式、LoraSetFreqCent参数。
This commit is contained in:
@@ -258,8 +258,6 @@ typedef struct {
|
||||
uint16_t LocalPort; //本地客户端端口(预留)
|
||||
}LTENetPara_t, *pLTENetPara;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t IpMode; //IP模式:DHCP/静态
|
||||
uint8_t IpAddr[4]; //本地IP地址
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
#define APP_START_FLAG 0x55AA5A5A
|
||||
#define APP_UPDATE_FLAG 0xA5A5AA55
|
||||
#define APP_BOOT_UPGRADE_FLAG 0x5A5A55A5
|
||||
|
||||
|
||||
#define WATCH_DOG 1
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user