Modify ota boot config
This commit is contained in:
parent
1703db93cb
commit
2c647495af
|
@ -589,7 +589,6 @@ static void *ATAgentReceiveProcess(void *param)
|
|||
memset(reply->reply_buffer, 0, reply->reply_max_len);
|
||||
memcpy(reply->reply_buffer, agent->maintain_buffer, agent->maintain_len);
|
||||
reply->reply_len = agent->maintain_len;
|
||||
printf("%s reply->reply_buffer=%s\n", __func__, reply->reply_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
@ -165,8 +165,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
|
||||
|
@ -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=2048
|
||||
CONFIG_OTA_FRAME_SIZE=1024
|
||||
|
||||
#
|
||||
# APP_Framework
|
||||
|
|
|
@ -194,18 +194,19 @@ CONFIG_TOOL_USING_OTA=y
|
|||
CONFIG_MCUBOOT_APPLICATION=y
|
||||
CONFIG_OTA_BY_PLATFORM=y
|
||||
# CONFIG_OTA_BY_TCPSERVER is not set
|
||||
# CONFIG_OTA_BY_NONE is not set
|
||||
|
||||
#
|
||||
# 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
|
||||
CONFIG_OTA_FRAME_SIZE=2048
|
||||
CONFIG_OTA_FRAME_SIZE=1024
|
||||
|
||||
#
|
||||
# APP_Framework
|
||||
|
@ -333,9 +334,9 @@ CONFIG_XIUOS_PLATFORM=y
|
|||
# xiuos platform mqtt connection parameter configuration.
|
||||
#
|
||||
CONFIG_CLIENTID="D001"
|
||||
CONFIG_USERNAME="xiuosiot"
|
||||
CONFIG_USERNAME="ch32v208"
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -102,8 +102,6 @@ CONFIG_KERNEL_CONSOLEBUF_SIZE=128
|
|||
# Command shell
|
||||
#
|
||||
# CONFIG_TOOL_SHELL is not set
|
||||
# CONFIG_SHELL_ENTER_CR_AND_LF is not set
|
||||
# CONFIG_SHELL_ENTER_CRLF is not set
|
||||
|
||||
#
|
||||
# Kernel data structure Manage
|
||||
|
@ -177,13 +175,13 @@ 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
|
||||
CONFIG_OTA_FRAME_SIZE=2048
|
||||
CONFIG_OTA_FRAME_SIZE=1024
|
||||
|
||||
#
|
||||
# APP_Framework
|
||||
|
@ -311,9 +309,9 @@ CONFIG_XIUOS_PLATFORM=y
|
|||
# xiuos platform mqtt connection parameter configuration.
|
||||
#
|
||||
CONFIG_CLIENTID="D001"
|
||||
CONFIG_USERNAME="xiuosiot"
|
||||
CONFIG_USERNAME="ch32v208"
|
||||
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
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ SECTIONS
|
|||
*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)
|
||||
*resources/serial*.o(.text)
|
||||
. = ALIGN(4);
|
||||
} >FLASH_FAST AT>FLASH_FAST
|
||||
|
||||
|
|
|
@ -75,42 +75,21 @@ void FLASH_DeInit(void)
|
|||
imageSize:要擦除的字节数
|
||||
* 返 回 值: 如果函数执行成功,状态值为 kStatus_Success,否则状态值为其他错误码
|
||||
*******************************************************************************/
|
||||
#ifdef MCUBOOT_BOOTLOADER
|
||||
status_t Flash_Erase(uint32_t start_addr, uint32_t imageSize)
|
||||
{
|
||||
uint32_t page_count;
|
||||
uint32_t pageNum = (imageSize%FLASH_PAGE_FAST_SIZE != 0)? (imageSize/FLASH_PAGE_FAST_SIZE + 1):(imageSize/FLASH_PAGE_FAST_SIZE);
|
||||
|
||||
KPrintf("Flash_Erase start_addr=%08x imageSize=0x%x\n", start_addr, imageSize);
|
||||
FLASH_Unlock_Fast();
|
||||
for(page_count = 0; page_count < pageNum; page_count++)
|
||||
{
|
||||
FLASH_ErasePage_Fast(start_addr + (page_count * FLASH_PAGE_FAST_SIZE));
|
||||
}
|
||||
FLASH_Lock_Fast();
|
||||
KPrintf("Flash_Erase start_addr=%08x success\n", start_addr);
|
||||
|
||||
return (status_t)kStatus_Success;
|
||||
}
|
||||
#else
|
||||
status_t Flash_Erase(uint32_t start_addr, uint32_t imageSize)
|
||||
{
|
||||
/*
|
||||
uint32_t page_count;
|
||||
uint32_t pageNum = (imageSize%FLASH_BLOCK_SIZE != 0)? (imageSize/FLASH_BLOCK_SIZE + 1):(imageSize/FLASH_BLOCK_SIZE);
|
||||
|
||||
KPrintf("Flash_Erase start_addr=%08x pageNum=0x%x\n", start_addr, imageSize);
|
||||
FLASH_Unlock();
|
||||
for(page_count = 0; page_count < pageNum; page_count++)
|
||||
{
|
||||
FLASH_ErasePage(start_addr + (page_count * FLASH_BLOCK_SIZE));
|
||||
}
|
||||
FLASH_Lock();
|
||||
KPrintf("Flash_Erase start_addr=%08x success\n", start_addr);
|
||||
*/
|
||||
return (status_t)kStatus_Success;
|
||||
}
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
* 函 数 名: Flash_Write
|
||||
* 功能描述: 写入W25QXX在指定地址开始写入指定长度的数据
|
||||
|
@ -120,40 +99,21 @@ status_t Flash_Erase(uint32_t start_addr, uint32_t imageSize)
|
|||
* 返 回 值: 如果函数执行成功,状态值为 kStatus_Success,否则状态值为其他错误码
|
||||
* 注 释: 该函数带擦除操作
|
||||
*******************************************************************************/
|
||||
#ifdef MCUBOOT_BOOTLOADER
|
||||
status_t Flash_Write(uint32_t WriteAddr, uint8_t *pBuffer, uint32_t NumByteToWrite)
|
||||
{
|
||||
uint32_t page_count;
|
||||
uint32_t pageNum = (NumByteToWrite%FLASH_PAGE_FAST_SIZE != 0)? (NumByteToWrite/FLASH_PAGE_FAST_SIZE + 1):(NumByteToWrite/FLASH_PAGE_FAST_SIZE);
|
||||
|
||||
KPrintf("Flash_Write start_addr=%08x pBuffer=%p NumByteToWrite=0x%x\n", WriteAddr, pBuffer, NumByteToWrite);
|
||||
FLASH_Unlock_Fast();
|
||||
for(page_count = 0; page_count < pageNum; page_count++)
|
||||
{
|
||||
FLASH_ProgramPage_Fast(WriteAddr + (page_count * FLASH_PAGE_FAST_SIZE), (uint32_t *)&pBuffer[page_count * FLASH_PAGE_FAST_SIZE]);
|
||||
}
|
||||
FLASH_Lock_Fast();
|
||||
KPrintf("Flash_Write start_addr=%08x success\n", WriteAddr);
|
||||
|
||||
return (status_t)kStatus_Success;
|
||||
}
|
||||
#else
|
||||
status_t Flash_Write(uint32_t WriteAddr, uint8_t *pBuffer, uint32_t NumByteToWrite)
|
||||
{
|
||||
uint32_t addr;
|
||||
uint32_t *p_buff = (uint32_t *)pBuffer;
|
||||
|
||||
KPrintf("Flash_Write start_addr=%08x pBuffer=%p NumByteToWrite=0x%x\n", WriteAddr, pBuffer, NumByteToWrite);
|
||||
FLASH_Unlock();
|
||||
for (addr = WriteAddr; addr < WriteAddr + NumByteToWrite; addr += 4, p_buff++) {
|
||||
FLASH_ProgramWord(addr, *p_buff);
|
||||
}
|
||||
FLASH_Lock();
|
||||
KPrintf("Flash_Write start_addr=%08x success\n", WriteAddr);
|
||||
|
||||
return (status_t)kStatus_Success;
|
||||
}
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
* 函 数 名: Flash_Read
|
||||
* 功能描述: 读Flash内容
|
||||
|
|
|
@ -970,6 +970,7 @@ reconnect:
|
|||
}
|
||||
else if(MqttRxbuf[0] == 0x30)
|
||||
{
|
||||
KPrintf("recv datalen %d \n", datalen);
|
||||
freecnt = 0;
|
||||
payloadLen = MQTT_DealPublishData(MqttRxbuf, datalen);
|
||||
|
||||
|
@ -989,7 +990,6 @@ reconnect:
|
|||
UpdateOTAFlag(p_ota_info);
|
||||
MQTT_Disconnect();
|
||||
mcuboot.flash_deinit();
|
||||
MdelayKTask(2000);
|
||||
mcuboot.op_reset();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue