main application address or backup application address in reliable update bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

main application address or backup application address in reliable update bootloader

Jump to solution
816 Views
ylkevin
Contributor I

In "Kinetis Bootloader v2.0.0 Reference Manual" Page 156, its description is:

1. Whether the crcStartAddress is equal to the start address of the vector table of the application.

question: the application is referred to main application or backup application?

The package "NXP_Kinetis_Bootloader_2_0_0" source code tells that it refers to the main application , however, what is the purpose for the crcStartAddress in BCA of backup application code to contain the address of main application code?

Any of guys can explain? Thanks!

Labels (1)
0 Kudos
1 Solution
713 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ylkenvin,

   After contact with our bootloader AE, the base address actually is the main application address.

  Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
5 Replies
713 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello ylkevin,

   From the Kinetis Bootloader v2.0.0 Reference Manual.pdf description, page 156,

1. Whether the crcStartAddress is equal to the start address of the vector table of the application.

This application should be the backup application.

pastedImage_1.png

2. what is the purpose for the crcStartAddress in BCA of backup application code to contain the address of main application code?

  Even from the ROM bootloader CRC description,

pastedImage_2.png

CRC should used to check the application integrity. If you check the backup application, the crcStartAddress should be the backup application address.

You said source code tells that it refers to the main application, could you point which source code, and tell me the detail information.

Thank you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
713 Views
ylkevin
Contributor I

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;

}

}

}

0 Kudos
714 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ylkenvin,

   After contact with our bootloader AE, the base address actually is the main application address.

  Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
713 Views
ylkevin
Contributor I

Hi,

Thanks for the information. It might be a source bug in released bootloader package.

Kevin

0 Kudos
713 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Kevin,

  You are welcome, yes, I already transfer the problem you mentioned to the according department.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos