OTA Invalid Image Flags

Hello,

I have successfully sent and received a OTA update via AWS using a STM32H743. However, while the image is initially read as valid and the new firmware version is booted, a reset causes the next bootloader to invalidate the new image and revert to the previous version.

The new firmware is loaded as follows:

"21/09/2021 19:07:31",[prvValidateImage] Validating image at Bank : 0
"21/09/2021 19:07:31",[prvValidateImage] Valid magic code at: 0x08040000
"21/09/2021 19:07:31",[prvValidateImage] Valid image flags: 0xfc at: 0x08040000
"21/09/2021 19:07:31",[prvValidateImage] Hardware ID is valid.
"21/09/2021 19:07:31",[prvValidateImage] Addresses are valid.
"21/09/2021 19:07:31",[prvValidateImage] Crypto signature is valid.

"21/09/2021 19:07:31",[prvValidateImage] Validating image at Bank : 1
"21/09/2021 19:07:31",[prvValidateImage] Valid magic code at: 0x08120000
"21/09/2021 19:07:31",[prvValidateImage] Valid image flags: 0xff at: 0x08120000
"21/09/2021 19:07:31",[prvValidateImage] Hardware ID is valid.
"21/09/2021 19:07:31",[prvValidateImage] Addresses are valid.
"21/09/2021 19:07:32",[prvValidateImage] Crypto signature is valid.

"21/09/2021 19:07:47",[prvBOOT_ValidateImages] Booting image with sequence number 362 at 0x08040000 
"21/09/2021 19:07:47",[prvBOOT_ExecuteImage] Updating the flags: 0xff, to: 0x00, for image at 0x08040000
"21/09/2021 19:07:47",[prvBOOT_ExecuteImage] Updated the image flags: 0x08040000
"21/09/2021 19:07:47",[prvBOOT_ExecuteImage] Watchdog timer started.

"21/09/2021 19:07:47",[BOOT_PAL_LaunchApplicationDesc] Booting image. 

The above bootloader function executing the image updates the flags: 0xff, to: 0x00, for image at 0x08040000, even though the previous function validating the image sees it as “Valid image flags: 0xfc at: 0x08040000”

After the reset, the OTA image is invalidated and the previous firmware is loaded as follows:

"21/09/2021 19:08:20",[prvValidateImage] Validating image at Bank : 0
"21/09/2021 19:08:20",[prvValidateImage] Valid magic code at: 0x08040000
"21/09/2021 19:08:20",[prvValidateImage] Invalid image flags: 0xfe at: 0x08040000
"21/09/2021 19:08:20",[prvBOOT_ValidateImages] Validation failed for image at 0x08040000 
"21/09/2021 19:08:20",[prvInvalidateImage] Full bank erase is disabled.
"21/09/2021 19:08:20",[prvBOOT_ValidateImages] Restoring backup image to : 0x08040000

"21/09/2021 19:08:33",[prvValidateImage] Validating image at Bank : 0
"21/09/2021 19:08:33",[prvValidateImage] Valid magic code at: 0x08040000
"21/09/2021 19:08:33",[prvValidateImage] Valid image flags: 0xfc at: 0x08040000
"21/09/2021 19:08:33",[prvValidateImage] Hardware ID is valid.
"21/09/2021 19:08:33",[prvValidateImage] Addresses are valid.
"21/09/2021 19:08:33",[prvValidateImage] Crypto signature is valid.

Is there a known reason why the FreeRTOS bootloader code would first see the valid image flags: 0xfc at: 0x08040000, then incorrectly read it as 0xff instead of 0xfc and update the flags: 0xff, to: 0x00, for image at 0x08040000

Then after reset, the code reads the image at 0x08040000 as being invalid with the flag: 0xfe at: 0x08040000

Any help would be much appreciated!

Hi, Greg. Can you give us more information about which code you are using? There are a couple of possible combinations.