Modify ota version and jump flag
This commit is contained in:
parent
4eb5f245cb
commit
fc82573bbe
|
@ -181,7 +181,7 @@ CONFIG_DOWN_FLAH_ADDRESS=0x08008000
|
|||
CONFIG_FLAG_FLAH_ADDRESS=0x08077000
|
||||
CONFIG_APP_FLASH_SIZE=0x00100000
|
||||
CONFIG_OTA_RX_TIMEOUT=600
|
||||
CONFIG_OTA_FRAME_SIZE=1024
|
||||
CONFIG_OTA_FRAME_SIZE=2048
|
||||
|
||||
#
|
||||
# APP_Framework
|
||||
|
|
|
@ -29,7 +29,7 @@ CONFIG_LTE_DEVICE_NAME_1="lte_dev1"
|
|||
#
|
||||
CONFIG_RESOURCES_SERIAL=y
|
||||
CONFIG_SERIAL_USING_DMA=y
|
||||
CONFIG_SERIAL_RB_BUFSZ=128
|
||||
CONFIG_SERIAL_RB_BUFSZ=2048
|
||||
|
||||
#
|
||||
# Kernel feature
|
||||
|
@ -117,7 +117,7 @@ CONFIG_SHELL_LOCK_TIMEOUT=10000
|
|||
#
|
||||
# Set shell config param
|
||||
#
|
||||
CONFIG_SHELL_TASK_STACK_SIZE=1024
|
||||
CONFIG_SHELL_TASK_STACK_SIZE=4096
|
||||
CONFIG_SHELL_TASK_PRIORITY=20
|
||||
CONFIG_SHELL_MAX_NUMBER=5
|
||||
CONFIG_SHELL_PARAMETER_MAX_NUMBER=8
|
||||
|
@ -206,7 +206,7 @@ CONFIG_DOWN_FLAH_ADDRESS=0x08008000
|
|||
CONFIG_FLAG_FLAH_ADDRESS=0x08077000
|
||||
CONFIG_APP_FLASH_SIZE=0x00100000
|
||||
CONFIG_OTA_RX_TIMEOUT=600
|
||||
CONFIG_OTA_FRAME_SIZE=1024
|
||||
CONFIG_OTA_FRAME_SIZE=2048
|
||||
|
||||
#
|
||||
# APP_Framework
|
||||
|
|
|
@ -181,7 +181,7 @@ CONFIG_DOWN_FLAH_ADDRESS=0x08008000
|
|||
CONFIG_FLAG_FLAH_ADDRESS=0x08077000
|
||||
CONFIG_APP_FLASH_SIZE=0x00100000
|
||||
CONFIG_OTA_RX_TIMEOUT=600
|
||||
CONFIG_OTA_FRAME_SIZE=1024
|
||||
CONFIG_OTA_FRAME_SIZE=2048
|
||||
|
||||
#
|
||||
# APP_Framework
|
||||
|
|
|
@ -250,4 +250,9 @@ void InitBoardHardware() {
|
|||
(x_ubase)MEMORY_END_ADDRESS, SRAM_SIZE, __stack_size);
|
||||
KPrintf("board init done.\n");
|
||||
KPrintf("start kernel...\n");
|
||||
|
||||
#ifdef TOOL_USING_OTA
|
||||
extern void app_clear_jumpflag(void);
|
||||
app_clear_jumpflag(); // set lastjumpflag to JUMP_SUCCESS_FLAG
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -487,12 +487,15 @@ static void BootLoaderJumpApp(void)
|
|||
if(p_ota_info->lastjumpflag == JUMP_FAILED_FLAG)
|
||||
{
|
||||
mcuboot.print_string("\r\n------Jump to app partition failed,start version rollback!------\r\n");
|
||||
#ifdef BOARD_CH32V208RBT6
|
||||
p_ota_info->lastjumpflag = JUMP_SUCCESS_FLAG;
|
||||
UpdateOTAFlag(p_ota_info);
|
||||
#else
|
||||
BackupVersion();
|
||||
#endif
|
||||
if(XIUOS_FLAH_ADDRESS == DOWN_FLAH_ADDRESS)
|
||||
{
|
||||
p_ota_info->status = OTA_STATUS_BOOT_DOWNLOAD;
|
||||
UpdateOTAFlag(p_ota_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
BackupVersion();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -985,6 +988,11 @@ reconnect:
|
|||
#ifndef MCUBOOT_BOOTLOADER
|
||||
if(XIUOS_FLAH_ADDRESS == DOWN_FLAH_ADDRESS)
|
||||
{
|
||||
if (strcmp(platform_ota.version, p_ota_info->os.version) == 0) {
|
||||
KPrintf("current version is the latest version and does not upgrade\n");
|
||||
MdelayKTask(2000);
|
||||
continue;
|
||||
}
|
||||
KPrintf("mqttCloudInteraction write OTA flag and reboot\n");
|
||||
p_ota_info->status = OTA_STATUS_BOOT_DOWNLOAD;
|
||||
UpdateOTAFlag(p_ota_info);
|
||||
|
@ -1134,6 +1142,11 @@ reconnect:
|
|||
memset(p_ota_info->down.description,0,sizeof(p_ota_info->down.description));
|
||||
strncpy(p_ota_info->down.description, "MQTT OTA bin.",sizeof(p_ota_info->down.description));
|
||||
|
||||
if(XIUOS_FLAH_ADDRESS == DOWN_FLAH_ADDRESS)
|
||||
{
|
||||
memcpy(&p_ota_info->os, &p_ota_info->down,sizeof(p_ota_info->os));
|
||||
}
|
||||
|
||||
p_ota_info->status = OTA_STATUS_READY;
|
||||
|
||||
memset(p_ota_info->error_message,0,sizeof(p_ota_info->error_message));
|
||||
|
@ -1419,13 +1432,13 @@ int OtaTask(void)
|
|||
*******************************************************************************/
|
||||
void app_clear_jumpflag(void)
|
||||
{
|
||||
ota_info_t ota_info;
|
||||
ota_info_t *p_ota_info = &g_ota_info;
|
||||
mcuboot.flash_init();
|
||||
//跳转成功设置lastjumpflag为JUMP_SUCCESS_FLAG
|
||||
memset(&ota_info, 0, sizeof(ota_info_t));
|
||||
mcuboot.op_flash_read(FLAG_FLAH_ADDRESS, (void*)&ota_info, sizeof(ota_info_t));
|
||||
ota_info.lastjumpflag = JUMP_SUCCESS_FLAG;
|
||||
UpdateOTAFlag(&ota_info);
|
||||
memset(p_ota_info, 0, sizeof(ota_info_t));
|
||||
mcuboot.op_flash_read(FLAG_FLAH_ADDRESS, (void*)p_ota_info, sizeof(ota_info_t));
|
||||
p_ota_info->lastjumpflag = JUMP_SUCCESS_FLAG;
|
||||
UpdateOTAFlag(p_ota_info);
|
||||
mcuboot.flash_deinit();
|
||||
}
|
||||
|
||||
|
@ -1511,8 +1524,11 @@ void ota_entry(void)
|
|||
BootLoaderJumpApp();
|
||||
}
|
||||
}
|
||||
Update();
|
||||
BootLoaderJumpApp();
|
||||
else
|
||||
{
|
||||
Update();
|
||||
BootLoaderJumpApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue