A/B swap bootloader. Update/Erase Firmware header

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

A/B swap bootloader. Update/Erase Firmware header

1,401 Views
kishore_nxp
Contributor II

firware_updates.PNG

This Update_FW_header() function is from s32k144_fota_bootloader for A/B bootloder functionality.

My question is that why has been old firmware header erased two times??? 

AND

we are downloading firmware to flash_new_address_block so we need to erase the header present at this address(means flash_new_address_block).Erasing the header at this address is done by 1st erase function which is correct but 2nd erase function is erasing header of firmware where we are not updating new firmware so there is no need to erase the header.

0 Kudos
1 Reply

1,379 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

 

Unfortunately, I'm working from home and I do not have the equipment to debug the code, however:

When you check the code you can see that the "Flash_Block_to_Update();" function is called for the first time. This function set flash_new_image_address_block and flash_old_image_address_block.

So, in the "Update_FW_header()" is not erased the same address two times

 

dianabatrlova_0-1611134161913.png

The functionality is described in the AN12323:

dianabatrlova_1-1611135472319.png

>>Erasing the header at this address is done by 1st erase function which is correct but 2nd erase function is erasing header of firmware where we are not updating new firmware so there is no need to erase the header.

Since the app key is stored at the end address of the latest fw header the oldest header is erased.

After that, you can recognize the new one fw from the old one fw. However, the SW is counting with the case that both fw headers have app key as is described in the above excerpt.

 

This is just an example project and you can modify it as you need according to your application requirements.

 

I hope it helps.

Best regards,

Diana

0 Kudos