app启动时如果boot魔数校验错误则自动升级bootloader
This commit is contained in:
@@ -22,14 +22,26 @@
|
||||
#include "elec_det.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// 升级bootloader
|
||||
static void boot_updata(void)
|
||||
{
|
||||
const uint8_t ALIGN(4) bootcode[]={
|
||||
#include "bootcode.txt"
|
||||
};
|
||||
if(sizeof(bootcode)==0)
|
||||
return;
|
||||
if(bk_check_magic_num())
|
||||
{
|
||||
flash_updata_boot((uint8_t *)bootcode,sizeof(bootcode));
|
||||
bk_reboot_app();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
const sys_param_def *par=sys_param();
|
||||
boot_updata();
|
||||
debug_init();
|
||||
elec_init();
|
||||
app_init();
|
||||
@@ -45,12 +57,7 @@ int main()
|
||||
|
||||
connect(protu2,protu_recv_signal,0,cmd,cmd_recv_slot);
|
||||
connect(cmd,cmd_reply_signal,0,protu2,protu_send_call);
|
||||
|
||||
// DBG_LOG("询预压");
|
||||
// DBG_LOG("我知道");
|
||||
//--diag_suppress=550,177
|
||||
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
elec_led2_power(1);
|
||||
@@ -87,7 +94,7 @@ static int test(list_def *argv)
|
||||
cmd_print("test num=%d,hex=%x",num,num);
|
||||
return 0;
|
||||
}
|
||||
commend_export(test,test,"cmd test")
|
||||
//commend_export(test,test,"cmd test")
|
||||
|
||||
|
||||
|
||||
@@ -270,7 +277,7 @@ static int sys_set(list_def *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
commend_export(set,sys_set,"set the system params")
|
||||
//commend_export(set,sys_set,"set the system params")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user