Key functions are assigned to FLASH_FAST

This commit is contained in:
songyanguang 2025-06-03 11:27:21 +08:00
parent 77ef32cbb9
commit a20a2d5327
8 changed files with 106 additions and 81 deletions

View File

@ -101,33 +101,10 @@ CONFIG_KERNEL_CONSOLEBUF_SIZE=128
#
# Command shell
#
CONFIG_TOOL_SHELL=y
CONFIG_SHELL_ENTER_CR=y
CONFIG_SHELL_ENTER_LF=y
CONFIG_SHELL_ENTER_CR_AND_LF=y
# CONFIG_TOOL_SHELL is not set
# CONFIG_SHELL_ENTER_CR_AND_LF is not set
# CONFIG_SHELL_ENTER_CRLF is not set
#
# Set shell user control
#
CONFIG_SHELL_DEFAULT_USER="letter"
CONFIG_SHELL_DEFAULT_USER_PASSWORD=""
CONFIG_SHELL_LOCK_TIMEOUT=10000
#
# Set shell config param
#
CONFIG_SHELL_TASK_STACK_SIZE=1024
CONFIG_SHELL_TASK_PRIORITY=20
CONFIG_SHELL_MAX_NUMBER=5
CONFIG_SHELL_PARAMETER_MAX_NUMBER=8
CONFIG_SHELL_HISTORY_MAX_NUMBER=5
CONFIG_SHELL_PRINT_BUFFER=128
CONFIG_SHELL_HELP_SHOW_PERMISSION=y
# CONFIG_SHELL_HELP_LIST_USER is not set
CONFIG_SHELL_HELP_LIST_VAR=y
# CONFIG_SHELL_HELP_LIST_KEY is not set
#
# Kernel data structure Manage
#
@ -190,8 +167,8 @@ CONFIG_FS_VFS_DEVFS=y
# OTA function
#
CONFIG_TOOL_USING_OTA=y
# CONFIG_MCUBOOT_BOOTLOADER is not set
CONFIG_MCUBOOT_APPLICATION=y
CONFIG_MCUBOOT_BOOTLOADER=y
# CONFIG_MCUBOOT_APPLICATION is not set
CONFIG_OTA_BY_PLATFORM=y
# CONFIG_OTA_BY_TCPSERVER is not set
# CONFIG_OTA_BY_NONE is not set
@ -200,9 +177,9 @@ CONFIG_OTA_BY_PLATFORM=y
# Flash area address and size configuration.
#
CONFIG_CHIP_FLAH_BASE=0x08000000
CONFIG_XIUOS_FLAH_ADDRESS=0x08030000
CONFIG_BAKUP_FLAH_ADDRESS=0x08030000
CONFIG_DOWN_FLAH_ADDRESS=0x08030000
CONFIG_XIUOS_FLAH_ADDRESS=0x08008000
CONFIG_BAKUP_FLAH_ADDRESS=0x08008000
CONFIG_DOWN_FLAH_ADDRESS=0x08008000
CONFIG_FLAG_FLAH_ADDRESS=0x08077000
CONFIG_APP_FLASH_SIZE=0x00100000
CONFIG_OTA_RX_TIMEOUT=600
@ -221,7 +198,7 @@ CONFIG_ADD_XIZI_FEATURES=y
# CONFIG_ADD_RTTHREAD_FEATURES is not set
# CONFIG_SUPPORT_SENSOR_FRAMEWORK is not set
CONFIG_SUPPORT_CONNECTION_FRAMEWORK=y
CONFIG_CONNECTION_FRAMEWORK_DEBUG=y
# CONFIG_CONNECTION_FRAMEWORK_DEBUG is not set
# CONFIG_CONNECTION_INDUSTRIAL_NETWORK is not set
# CONFIG_CONNECTION_INDUSTRIAL_FIELDBUS is not set
# CONFIG_CONNECTION_INDUSTRIAL_WLAN is not set
@ -336,7 +313,7 @@ CONFIG_XIUOS_PLATFORM=y
CONFIG_CLIENTID="D001"
CONFIG_USERNAME="xiuosiot"
CONFIG_PASSWORD="xiuosiot"
CONFIG_PLATFORM_SERVERIP="115.238.53.59"
CONFIG_PLATFORM_SERVERIP="47.115.50.232"
CONFIG_PLATFORM_SERVERPORT="1883"
# CONFIG_USING_DOWNLOAD_JSON is not set

View File

@ -26,8 +26,7 @@ MEMORY
FLASH-144K + RAM-48K
FLASH-160K + RAM-32K
*/
/*FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 448K*/
FLASH (rx) : ORIGIN = 0x00030000, LENGTH = 284K
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 288K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
}
@ -44,19 +43,19 @@ SECTIONS
_einit = .;
} >FLASH AT>FLASH
.vector :
{
*(.vector);
. = ALIGN(64);
} >FLASH AT>FLASH
.highcode :
{
. = ALIGN(4);
*(.highcode);
*(.highcode.*);
. = ALIGN(4);
} >FLASH AT>FLASH
.vector :
{
*(.vector);
. = ALIGN(64);
} >FLASH AT>FLASH
.highcode :
{
. = ALIGN(4);
*(.highcode);
*(.highcode.*);
. = ALIGN(4);
} >FLASH AT>FLASH
.text :
{

View File

@ -26,15 +26,14 @@ MEMORY
FLASH-144K + RAM-48K
FLASH-160K + RAM-32K
*/
/*FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64K*/
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 192K
FLASH_FAST (rx) : ORIGIN = 0x00000000, LENGTH = 32K
FLASH (rx) : ORIGIN = 0x00048000, LENGTH = 156K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
}
SECTIONS
{
.init :
{
_sinit = .;
@ -42,22 +41,34 @@ SECTIONS
KEEP(*(SORT_NONE(.init)))
. = ALIGN(4);
_einit = .;
} >FLASH AT>FLASH
} >FLASH_FAST AT>FLASH_FAST
.vector :
{
*(.vector);
. = ALIGN(64);
} >FLASH AT>FLASH
.highcode :
{
. = ALIGN(4);
*(.highcode);
*(.highcode.*);
.vector :
{
*(.vector);
. = ALIGN(64);
} >FLASH_FAST AT>FLASH_FAST
.highcode :
{
. = ALIGN(4);
*(.highcode);
*(.highcode.*);
. = ALIGN(4);
} >FLASH AT>FLASH
} >FLASH_FAST AT>FLASH_FAST
.text.fast :
{
. = ALIGN(4);
*(.text.fast)
*arch/risc-v/ch32v208rbt6*.o(.text)
*board/ch32v208rbt6/third_party_driver/Peripheral/src/ch32v20x_flash.o(.text)
*board/ch32v208rbt6/third_party_driver/Peripheral/src/ch32v20x_usart.o(.text)
*board/ch32v208rbt6/third_party_driver/lte/connect_lte.o(.text)
*kernel/thread*.o(.text)
. = ALIGN(4);
} >FLASH_FAST AT>FLASH_FAST
.text :
{
. = ALIGN(4);

View File

@ -50,6 +50,6 @@ int32_t Ymodem_Receive(uint8_t *buf, const uint32_t addr)
*******************************************************************************/
int32_t SerialDownload(const uint32_t addr)
{
int32_t Size = IMAGE_IAP_SIZE;
int32_t Size = 1; //TODO: 208 does not support serial download
return Size;
}

View File

@ -22,7 +22,7 @@
#define __BOOT_FOR_OTA_H__
#define IMAGE_IAP_START_ADD 0x08000000
#define IMAGE_IAP_SIZE (192 * 1024)
#define IMAGE_IAP_SIZE (32 * 1024)
#define IMAGE_A_START_ADD (IMAGE_IAP_START_ADD + IMAGE_IAP_SIZE)
void mcuboot_bord_init(void);

View File

@ -65,13 +65,6 @@ static uint32_t _SysTick_Config(uint32_t ticks) {
void mcuboot_bord_init(void)
{
DISABLE_INTERRUPT();
/* system irq table must be inited before initialization of Hardware irq */
SysInitIsrManager();
// InitBoardHardware();
// XiUOSStartup();
Delay_Init();
USART_Printf_Init(115200);
/* System Tick Configuration */
@ -90,14 +83,7 @@ void mcuboot_bord_init(void)
void readRomConfiguration(void);
readRomConfiguration(); // 读取配置信息到外部变量CFG中
KPrintf("mcuboot board initialization......\n");
/*
BOARD_ConfigMPU();
BOARD_InitPins();
BOARD_BootClockRUN();
UartConfig();
SysTick_Config(SystemCoreClock / TICK_PER_SECOND);*/
KPrintf("mcuboot board init done.\n");
}
void mcuboot_reset(void)

View File

@ -188,6 +188,19 @@ static status_t UpdateOTAFlag(ota_info_t *ptr)
return status;
}
/*******************************************************************************
* : GetOTAFlagStatus
* : OTA Flag区域的Status信息
* :
* :
*******************************************************************************/
static uint32_t GetOTAFlagStatus(void)
{
ota_info_t ota_info;
memset(&ota_info, 0, sizeof(ota_info_t));
mcuboot.op_flash_read(FLAG_FLAH_ADDRESS, (void*)&ota_info, sizeof(ota_info_t));
return ota_info.status;
}
/*******************************************************************************
* : InitialVersion
@ -899,12 +912,27 @@ static void mqttCloudInteraction(void* parameter)
mcuboot.flash_init();
memset(p_ota_info, 0, sizeof(ota_info_t));
mcuboot.op_flash_read(FLAG_FLAH_ADDRESS, (void*)p_ota_info, sizeof(ota_info_t));
#ifdef MCUBOOT_BOOTLOADER
p_ota_info->status = OTA_STATUS_BOOT_DOWNLOAD;
#else
p_ota_info->status = OTA_STATUS_DOWNLOADING;
#endif
UpdateOTAFlag(p_ota_info);
memset(topicdatabuff,0,sizeof(topicdatabuff));
sprintf(topicdatabuff[0],"ota/%s/update",CLIENTID);
sprintf(topicdatabuff[1],"ota/%s/files",CLIENTID);
#if 1 //debug
if((AdapterNetActive() == 0) )
{
KPrintf("mqttCloudInteraction write OTA flag and reboot\n");
p_ota_info->status = OTA_STATUS_BOOT_DOWNLOAD;
UpdateOTAFlag(p_ota_info);
MdelayKTask(2000);
mcuboot.op_reset();
}
#endif
reconnect:
if((AdapterNetActive() == 0) && MQTT_Connect() && MQTT_SubscribeTopic(topicdatabuff[0]) && MQTT_SubscribeTopic(topicdatabuff[1]))
{
@ -1408,6 +1436,11 @@ void ota_entry(void)
uint32_t ret;
uint32_t timeout = 1000;
if(XIUOS_FLAH_ADDRESS == DOWN_FLAH_ADDRESS) {
DISABLE_INTERRUPT();
SysInitIsrManager();
}
mcuboot.board_init();
mcuboot.print_string("Please press 'space' key into menu in 5s !!!\r\n");
@ -1453,6 +1486,24 @@ void ota_entry(void)
//10s内不按下空格键默然进行升级,升级完成后跳转
else
{
if(XIUOS_FLAH_ADDRESS == DOWN_FLAH_ADDRESS)
{
if(OTA_STATUS_BOOT_DOWNLOAD == GetOTAFlagStatus())
{
#ifdef BSP_USING_LTE
mcuboot.print_string("ota_entry to InitHwLte\r\n");
extern int InitHwLte(void);
InitHwLte();
#endif
mcuboot.print_string("ota_entry to XiUOSStartup\r\n");
extern int XiUOSStartup(void);
XiUOSStartup();
}
else
{
BootLoaderJumpApp();
}
}
Update();
BootLoaderJumpApp();
}

View File

@ -34,6 +34,7 @@ typedef enum {
OTA_STATUS_DOWNLOADED, //固件下载完成
OTA_STATUS_UPDATING, //正在进行OTA升级
OTA_STATUS_BACKUP, //正在版本回退
OTA_STATUS_BOOT_DOWNLOAD,//boot阶段下载固件
OTA_STATUS_ERROR, //出现错误,升级失败
} ota_status_t;