1 Commits

Author SHA1 Message Date
YuanHongbin 2b23e8f0ed 增加了BootPara结构体的参数信息 2026-05-11 10:02:31 +08:00
3 changed files with 49 additions and 7 deletions
+14 -4
View File
@@ -103,7 +103,7 @@
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>12</nTsel>
<nTsel>6</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
@@ -114,7 +114,7 @@
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>BIN\CMSIS_AGDI.dll</pMon>
<pMon>Segger\JL2CM3.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
@@ -130,7 +130,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
<Name>-U4294967295 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8027 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0FlashHC32L17X_128K.FLM -FS00 -FL020000 -FP0($$Device:HC32L170JATA$Flash\FlashHC32L17X_128K.FLM)</Name>
<Name>-U4294967295 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8027 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO31 -FD20000000 -FC1000 -FN1 -FF0FlashHC32L17X_128K.FLM -FS00 -FL020000 -FP0($$Device:HC32L170JATA$Flash\FlashHC32L17X_128K.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@@ -190,6 +190,16 @@
<WinNumber>1</WinNumber>
<ItemText>BL.Status,0x0A</ItemText>
</Ww>
<Ww>
<count>7</count>
<WinNumber>1</WinNumber>
<ItemText>BL.Para</ItemText>
</Ww>
<Ww>
<count>8</count>
<WinNumber>1</WinNumber>
<ItemText>DevMac</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
@@ -213,7 +223,7 @@
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
+20 -2
View File
@@ -43,7 +43,20 @@ typedef enum {
MASTER = 0x000000, //0x000000 主设备
SUBSET = 0x800000, //0x800000 子设备
}DEVICE_SIGN_M;
/*Lora频率:433100000ul + 200000*N */
typedef enum {
CH0 = (433100000ul + 0), //测试频率
CH1 = (433100000ul + 200000),
CH2 = (433100000ul + 400000),
CH3 = (433100000ul + 600000),
CH4 = (433100000ul + 800000),
CH5 = (433100000ul + 1000000),
CH6 = (433100000ul + 1200000),
CH7 = (433100000ul + 1400000),
CH8 = (433100000ul + 1600000),
CH9 = (433100000ul + 1800000),
CH10 = (433100000ul + 2000000),
}LORA_FREQ_M;
/*设备类型选择*/
#define DEVICE_TYPE LASER_TRACING
/*通讯方式选择*/
@@ -51,7 +64,9 @@ typedef enum {
/*设备标志选择*/
#define DEVICE_SIGN MASTER
/*设备地址编号设置*/
#define ADD_NUMBER (0x000000 + DEVICE_SIGN) //数字部分对应唯一地址编号
#define ADD_NUMBER (0x000023 + DEVICE_SIGN) //数字部分对应唯一地址编号
/*Lora频率配置*/
#define LORA_FREQ CH1
#if(DEVICE_TYPE == LASER_TRACING)
#define LP_UART_CH 0
@@ -228,6 +243,9 @@ typedef struct {
uint32_t PackageCnt;
uint32_t AppSize;
uint32_t Crc32Check;
uint32_t FirstRunFlag;//第一次运行
uint8_t DevMac[6];//设备MAC
uint32_t LoraFreq;//Lora频率
}BootPara_t, *BootPara;
typedef void (*ReadPara)(BootPara_t rPara);
+15 -1
View File
@@ -259,7 +259,21 @@ int32_t main(void)
InitCrc32Table(pdwCrc32Tbl);
ReadBootPara(&BL.Para);
if(BL.Para.AppFlag == APP_START_FLAG) {
if((BL.Para.DevMac[0] | (BL.Para.DevMac[1] << 8)) != DEVICE_TYPE){ //设备类型错误,清除升级参数
if(BL.Para.FirstRunFlag == 0xFFFFFFFF) {
BL.Status = BL_START_APP;
}
else {
BL.Status = BL_IDLE;
}
BL.Para.AppFlag = 0;
BL.Para.UpdateFlag = 0;
BL.Para.FirstRunFlag = 0;
memcpy(&BL.Para.DevMac, &DevMac[0], 6);
BL.Para.LoraFreq = LORA_FREQ;
WriteBootPara(&BL.Para);
}
else if(BL.Para.AppFlag == APP_START_FLAG) {
BL.Status = BL_START_APP;
}
else if(BL.Para.UpdateFlag == APP_UPDATE_FLAG) {