Dear Kerry
Thank you for your reply.
When the BL code goes to bootloader_reliable_update_as_requested
if (is_specified_application_valid(backupApplicationBase))
if (header.crcStartAddress != mainApplicationBase)
{
return false;
}
Here crcStartAddress must be BL_APP_VECTOR_TABLE_ADDRESS or BL_BACKUP_APP_START.
Two code comments ( as listed ) gave different explanation.
If BL_BACKUP_APP_START, surely return false, then reliable update fail to complete!
Liyue
// Determine if the application is valid.
// Note: the applicaiton is valid only if following conditions are met:
// 1. (backup image only)crcByteCount <= backup app start - BL_APP_VECTOR_TABLE_ADDRESS -
// sizeof(header.expectedCrcValue).
// 2. crcStartAddress = BL_APP_VECTOR_TABLE_ADDRESS
// 3. The calculated crc checksum = expectedCrcValue
static bool is_specified_application_valid(uint32_t applicationBase)
{
crc_checksum_header_t header;
uint32_t crcChecksumBase = get_bootloader_config_area_base(applicationBase);
uint32_t mainApplicationBase = get_application_base(kSpecifiedApplicationType_Main);
memcpy(&header, (void *)crcChecksumBase, sizeof(header));
// The size of the backup image must be less than or equal to maximumn reserved backup application space
if (applicationBase != mainApplicationBase)
{
uint32_t maxBackupAppSize = get_max_backup_app_size(applicationBase);
int32_t backupAppSize = header.crcByteCount;
if (backupAppSize > maxBackupAppSize)
{
return false;
}
}
// crcStartAddress must be BL_BACKUP_APP_START, and calculated crc checksum must be expectedCrcValue
if (header.crcStartAddress != mainApplicationBase)
{
return false;
}
else
{
header.crcStartAddress = applicationBase;
uint32_t calculatedCrc = calculate_application_crc32(&header, crcChecksumBase);
if (calculatedCrc != header.crcExpectedValue)
{
return false;
}
else
{
return true;
}
}
}