cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU BL is not transferring controller to UserApp

Grogu
Associate III

Hi,

First of all nice application note for getting started with SBSFU cheers :thumbs_up:

Let me provide details of steps which I followed

Device - STM32H7B3I-DK

Followed AN5056 - Integration guide for the X-CUBE-SBSFU. Under section 4.4 Development or production mode configuration enabled development flow

  1.  
@@ -59,11 +59,11 @@ extern "C" {
 #define SFU_DEBUG_MODE               /*!< Comment this define to optimize memory footprint (debug mode removed)
                                           No more print on terminal during SBSFU execution */
 
-/*#define SFU_VERBOSE_DEBUG_MODE*/   /*!< Uncomment this define when in verbose Debug mode.
+#define SFU_VERBOSE_DEBUG_MODE       /*!< Uncomment this define when in verbose Debug mode.
                                           this switch activates more debug prints in the console (FSM state info...) */
 
 
-/*#define SFU_FWIMG_BLOCK_ON_ABNORMAL_ERRORS_MODE*/  /*!< You may uncomment this define when running development tests.
+#define SFU_FWIMG_BLOCK_ON_ABNORMAL_ERRORS_MODE  /*!< You may uncomment this define when running development tests.
                                                           When this switch is activated, the FWIMG part of SB_SFU will
                                                           block when an abnormal error is encountered */
 
@@ -142,7 +142,8 @@ extern "C" {
  *
  */
 
-/*#define SECBOOT_DISABLE_SECURITY_IPS*/  /*!< Disable all security IPs at once when activated */
+#define SECBOOT_DISABLE_SECURITY_IPS  /*!< Disable all security IPs at once when activated */
 
 #if !defined(SECBOOT_DISABLE_SECURITY_IPS)

2.

Then started building projects, run into overflow error

0693W00000HoyKiQAJ.pngFixed it by referring to section 6.2 Memory mapping adaptation

0693W00000HoyDPQAZ.png 

3. Now at this stage SBSFU and UserApp application build successfully

4.Now SBSFU is programmed to board using STM32CubeProgrammer

5.User application is send using tera term with

Baud rate = 115200

  - Data = 8 bits

  - Parity = none

  - Stop = 1 bit

  - Flow control = none

6 SBSFU executing

0693W00000HoyP4QAJ.png

7 User application send to device

0693W00000HoyQ2QAJ.png 

Now instead of actually jumping to application SBSFU is still waiting for UserApp :pensive_face:

0693W00000HoyQqQAJ.png 

In sfu_boot.c control is returning from

0693W00000HoyJNQAZ.png 

Hoping to get some pointer on what is going wrong in system.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Jocelyn RICARD
ST Employee

Hello @Community member​ 

On STM32H7B3 the flash sector size is 8KB.

So, when you extend the size of one element it is better to align on this.

Also, of you extend the SBSFU memory size by 8KB you will need to move the first slot in mapping_fwimg.ld

So, if you add 8KB to SBSFU you will start 8KB further

__ICFEDIT_SLOT_Active_1_start__ = 0x08010000;

should be changed in

__ICFEDIT_SLOT_Active_1_start__ = 0x08010000 + 0x2000;

Other point to be aware of, which is related to the comment in mapping_sbsfu.ld

/* Aligned SBSFU end at the end of the 1st 64Kbytes of FLASH, MPU protection constraints */

As this alignment is no more respected, the MPU configuration will need to be adapted.

MPU configuration for this part is MPU region 3.

One way to setup is to set MPU region 128KB and but use only first 5 subregions.

1 subregion size for 128KB is 16KB (16*8=128)

So, you would need to allocate 16KB more for SBSFU instead of 8KB.

This results in:

__ICFEDIT_SB_region_ROM_end__       = 0x0803FFFF;

__ICFEDIT_SLOT_Active_1_start__ = 0x08010000 + 0x4000;

And then MPU configuration

#define SFU_PROTECT_MPU_FLASHEXE_SIZE MPU_REGION_SIZE_128KB

#define SFU_PROTECT_MPU_FLASHEXE_SREG 0xE0U 

0xE0 means you exclude the 3 last subregions (this is a bit field)

I hope this will help

Best regards

Jocelyn

View solution in original post

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @Community member​ 

On STM32H7B3 the flash sector size is 8KB.

So, when you extend the size of one element it is better to align on this.

Also, of you extend the SBSFU memory size by 8KB you will need to move the first slot in mapping_fwimg.ld

So, if you add 8KB to SBSFU you will start 8KB further

__ICFEDIT_SLOT_Active_1_start__ = 0x08010000;

should be changed in

__ICFEDIT_SLOT_Active_1_start__ = 0x08010000 + 0x2000;

Other point to be aware of, which is related to the comment in mapping_sbsfu.ld

/* Aligned SBSFU end at the end of the 1st 64Kbytes of FLASH, MPU protection constraints */

As this alignment is no more respected, the MPU configuration will need to be adapted.

MPU configuration for this part is MPU region 3.

One way to setup is to set MPU region 128KB and but use only first 5 subregions.

1 subregion size for 128KB is 16KB (16*8=128)

So, you would need to allocate 16KB more for SBSFU instead of 8KB.

This results in:

__ICFEDIT_SB_region_ROM_end__       = 0x0803FFFF;

__ICFEDIT_SLOT_Active_1_start__ = 0x08010000 + 0x4000;

And then MPU configuration

#define SFU_PROTECT_MPU_FLASHEXE_SIZE MPU_REGION_SIZE_128KB

#define SFU_PROTECT_MPU_FLASHEXE_SREG 0xE0U 

0xE0 means you exclude the 3 last subregions (this is a bit field)

I hope this will help

Best regards

Jocelyn

Thanks @Jocelyn RICARD​ for detailed and complete instructions on

  • Application offset to accommodate increase in SBU size.
  • SBU alignment requirement
  • MPU configuration

:thumbs_up:

BL is transferring control to application code

0693W00000HpJORQA3.png