2020-07-07 04:30 AM
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;
2020-07-08 02:33 AM
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.
2020-07-08 03:41 AM
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);
2020-07-08 04:05 AM
And if it fails to delete memory, this has to return error right? but this returns SFU_SUCCESS which is not ok.
2021-03-23 09:26 AM
Hi,
is there a solution for this bug ?
I'm facing the same problem ...
2022-01-18 01:43 AM
Hi,
Same issue here, did anyone manage to fix it ?
Is it a SBSFU related bug, or some memory protection wrongly removed... ?
Thanks