cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU Abnormal error during swapping of downloaded firmware image

ANaga.2
Associate II

Hi,

I am facing untraceable issue with SBSFU. I integrated SBSFU features to our application running on device with 512kb flash.

After downloading the firmware, during the swapping, it is throwing some abnormal errors while writing to addresses 0x0803FE00, 0x0803EE00 and 0x0803DE00. Below is the error from the trace.

======================================================================

=       (C) COPYRIGHT 2017 STMicroelectronics         =

=                                  =

=       Secure Boot and Secure Firmware Update        =

======================================================================

= [SBOOT] SECURE ENGINE INITIALIZATION SUCCESSFUL

= [SBOOT] STATE: CHECK STATUS ON RESET

     INFO: A Reboot has been triggered by a Software reset!

     Consecutive Boot on error counter = 0

     INFO: Last execution detected error was:Error while swapping the images in slot #0 and slot #1.

= [SBOOT] STATE: CHECK USER FW STATUS

     Installation Failed: resume installation procedure initiated

= [SBOOT] STATE: RESUME INSTALLATION OF NEW USER FIRMWARE

     Image preparation done.

     Swapping the firmware images........

     Abnormal error 2 at line 1071 in C:/SBSFU_DEMO_HUD/STM32CubeExpansion_SBSFU_V2.3.0/Projects/NUCLEO-L432KC/Applications/2_Images/2_Images_SBSFU/SBSFU/App/sfu_fwimg_core.c - CONTINUE

= [SBOOT] STATE: HANDLE CRITICAL FAILURE

What I observed here is these 3 memory addresses will be having some data and they are not deleted on the time of writing new data. I assume this is causing the issue. But I am not sure why at only these addresses, memory is not cleared before writing. During the writing of data to these addresses, status registry FLASH->SR will be set to 168.

Below the memory distribution I am using for 512kb flash.

/* swap region (8 kbytes) */

__ICFEDIT_region_SWAP_start__  = 0x0800F000;  

__ICFEDIT_region_SWAP_end__   = 0x08010FFF;

/* slot 0 region (216 kbytes) */

__ICFEDIT_region_SLOT_0_start__ = 0x08011000;  

__ICFEDIT_region_SLOT_0_end__  = 0x08046FFF;

/* slot 1 region (216 kbytes) */

__ICFEDIT_region_SLOT_1_start__ = 0x08047000;  

__ICFEDIT_region_SLOT_1_end__  = 0x0807CFFF;

5 REPLIES 5
ANaga.2
Associate II

Looks like its a bug in SBSFU feature. At addresses 0x803F000, 0x803D000 and 0x803B000, it fails to delete the memory and SBSFU restarts and execution starts from where it had left and deletes the memory in the 2nd try successfully and fails for next 8kb memory. this happens 3 times and system fails completely.

ANaga.2
Associate II

I assume the below 3 lines of code is failing to put 0xff values for the pages (2k size each) which starts with address 0x803F000, 0x803D000 and 0x803B000.

MODIFY_REG(FLASH->CR, FLASH_CR_PNB, ((Page & 0xFFU) << FLASH_CR_PNB_Pos));

 SET_BIT(FLASH->CR, FLASH_CR_PER);

 SET_BIT(FLASH->CR, FLASH_CR_STRT);

ANaga.2
Associate II

And if it fails to delete memory, this has to return error right? but this returns SFU_SUCCESS which is not ok.

peterd
Associate II

Hi,

is there a solution for this bug ?

I'm facing the same problem ...

APOIR.1
Associate II

Hi,

Same issue here, did anyone manage to fix it ?

Is it a SBSFU related bug, or some memory protection wrongly removed... ?

Thanks