适配Ew开头的协议

注释iic相关命令,添加命令jwtcrc用于验证jwt程序是否正常
    EW_Updata 添加错误12表示小板中无jwt程序
This commit is contained in:
ranchuan
2023-12-29 18:13:00 +08:00
parent c676f81758
commit a51722b54a
12 changed files with 192 additions and 168 deletions

View File

@@ -29,6 +29,7 @@
#define UPDATA_CRC_ALL ((uint32_t *)(MC_CODE_ADDR+16*1024))[0]
#define UPDATA_CRC_APP ((uint32_t *)(MC_CODE_ADDR+16*1024))[1]
#define UPDATA_FILE_NAME ((const char *)(MC_CODE_ADDR+16*1024+8))
@@ -50,7 +51,7 @@ static int cmd_jwt_boot_erase(list_def *argv)
ret=EW_bootErease();
return ret;
}
commend_export(jwt_boot_erase,cmd_jwt_boot_erase,"jwt srase in boot")
//commend_export(jwt_boot_erase,cmd_jwt_boot_erase,"jwt srase in boot")
// 跳转
@@ -70,7 +71,7 @@ static int cmd_jwt_boot_jump(list_def *argv)
ret=EW_bootJump();
return ret;
}
commend_export(jwt_boot_jump,cmd_jwt_boot_jump,"jwt jump in boot")
//commend_export(jwt_boot_jump,cmd_jwt_boot_jump,"jwt jump in boot")
// 充电
@@ -91,7 +92,7 @@ static int cmd_jwt_boot_charg(list_def *argv)
ret=EW_bootCharg();
return ret;
}
commend_export(jwt_boot_charg,cmd_jwt_boot_charg,"jwt charg in boot")
//commend_export(jwt_boot_charg,cmd_jwt_boot_charg,"jwt charg in boot")
@@ -112,7 +113,7 @@ static int cmd_jwt_boot_discharg(list_def *argv)
ret=EW_bootDisCharg();
return ret;
}
commend_export(jwt_boot_discharg,cmd_jwt_boot_discharg,"jwt discharg in boot")
//commend_export(jwt_boot_discharg,cmd_jwt_boot_discharg,"jwt discharg in boot")
@@ -172,7 +173,27 @@ static int cmd_jwt_boot_checkcrc(list_def *argv)
cmd_print("local crc32=0x%04x.",crc);
return ret;
}
commend_export(jwt_boot_checkcrc,cmd_jwt_boot_checkcrc,"jwt checkcrc in boot")
//commend_export(jwt_boot_checkcrc,cmd_jwt_boot_checkcrc,"jwt checkcrc in boot")
// 校验jwt程序的crc
static int cmd_jwtcrc(list_def *argv)
{
int ret=0;
uint32_t crc=0,crc2=0;
crc=Crc32Calu((uint32_t *)(MC_CODE_ADDR+UPDATA_BASE_ADDR),UPDATA_DATA_LEN);
crc2=UPDATA_CRC_APP;
cmd_print("crc_calc=0x%08x,crc_rom=0x%08x.",crc,crc2);
if(crc==crc2){
cmd_print("rom name:%s.",UPDATA_FILE_NAME);
}
return ret;
}
commend_export(jwtcrc,cmd_jwtcrc,"check jwt app crc32.")
@@ -215,7 +236,7 @@ static int cmd_jwt_app_read(list_def *argv)
ret=EW_appRead();
return ret;
}
commend_export(jwt_app_read,cmd_jwt_app_read,"jwt read in app")
//commend_export(jwt_app_read,cmd_jwt_app_read,"jwt read in app")
// app:通信测试
@@ -235,7 +256,7 @@ static int cmd_jwt_app_commtest(list_def *argv)
ret=EW_appCommTest();
return ret;
}
commend_export(jwt_app_commtest,cmd_jwt_app_commtest,"jwt commtest in app")
//commend_export(jwt_app_commtest,cmd_jwt_app_commtest,"jwt commtest in app")
@@ -255,7 +276,7 @@ static int cmd_jwt_app_runboot(list_def *argv)
EW_appRunBoot();
return ret;
}
commend_export(jwt_app_runboot,cmd_jwt_app_runboot,"jwt turn to bootloader")
//commend_export(jwt_app_runboot,cmd_jwt_app_runboot,"jwt turn to bootloader")
@@ -389,6 +410,15 @@ void EW_Updata(void)
ew_updata.time_poweroff=checker_runcfg.params[2];
// 升级模式0无app时升级1无条件升级
ew_updata.updata_mode=checker_runcfg.params[3];
// 校验jwt程序是否正常
crc=Crc32Calu((uint32_t *)(MC_CODE_ADDR+UPDATA_BASE_ADDR),UPDATA_DATA_LEN);
if(crc!=UPDATA_CRC_APP)
{
ret=12;
goto err;
}
EW_ParamPrint(&ew_updata);
PowerCalibration_set(200,120);
ret=EW_CheckState(&ew_updata);