OTA info addresses need to be aligned
This commit is contained in:
@@ -79,7 +79,7 @@ void readRomConfiguration(void) {
|
||||
if ((CFG->cfgFlag[0] != checkcode1) || (CFG->cfgFlag[1] != checkcode2)) {
|
||||
CFG_ERASE(PAGE_WRITE_START_ADDR, FLASH_PAGE_SIZE);
|
||||
CFG_WRITE(PAGE_WRITE_START_ADDR, (u8 *)&defaultConfiguration, MODULE_CFG_LEN);
|
||||
KPrintf("%s NVIC_SystemReset\n", __func__);
|
||||
KPrintf("%s NVIC_SystemReset\n\n", __func__);
|
||||
NVIC_SystemReset(); // 复位ch32v208
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ void mcuboot_reset(void)
|
||||
|
||||
void mcuboot_jump(void)
|
||||
{
|
||||
KPrintf("boot jumpApp\n");
|
||||
KPrintf("boot jumpApp\n\n");
|
||||
jumpApp();
|
||||
/*
|
||||
uint32_t addr = XIUOS_FLAH_ADDRESS;
|
||||
|
||||
@@ -80,14 +80,14 @@ 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=0x%x imageSize=0x%x\n", start_addr, imageSize);
|
||||
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=0x%x success\n", start_addr);
|
||||
KPrintf("Flash_Erase start_addr=%08x success\n", start_addr);
|
||||
|
||||
return (status_t)kStatus_Success;
|
||||
}
|
||||
@@ -106,14 +106,14 @@ status_t Flash_Write(uint32_t WriteAddr, uint8_t *pBuffer, uint32_t NumByteToWri
|
||||
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=0x%x imageSize=0x%x\n", WriteAddr, NumByteToWrite);
|
||||
KPrintf("Flash_Write start_addr=%08x pBuffer=%p imageSize=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=0x%x success\n", WriteAddr);
|
||||
KPrintf("Flash_Write start_addr=%08x success\n", WriteAddr);
|
||||
|
||||
return (status_t)kStatus_Success;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user