cancel
Showing results for 
Search instead for 
Did you mean: 

Porting SBSFU from running on STM32H7B3i-DK to STM32H7B0 custom board.

onio
Senior

I am currently trying to port SBSFU from running on STM32H7B3i-DK to run on a custom board that has a STM32H7B0 microcontroller onboard developing with Keil MDK version 5.

I am using the example standalone loader project STM32H7B3I_DISCO_2_Images_Loader from ST as my base. Using the STM32H7B3i-DK I have been able to build the following 4 projects contained in STM32CubeExpansion_SBSFU_V2.3.0.

More specifically I am using the STM32CubeExpansion_SBSFU_V2.3.0\Projects\STM32H7B3I-DK\Applications\2_Images_ExtFlash example.

I have also been able to make changes to the STM32H7B3I_DISCO_2_Images_UserApp and load the firmware with the SBSFU loader using STM32CubeProgrammer.

The problem I am having now is getting the SBSFU to run on our custom board but not getting any joy. 

I have tried following AN5056 Application note but not getting far for the following two reasons 

(1) Using IAR development tool (Linker example)

(2) Not showing external flash example.

I can confirm that our custom board is working fine as I have been able to successfully create a standalone project that runs 

and which I can also debug (set breakpoints, single step, and run with debugger)

Since the STM32H7B0 only has 128Kbytes onboard flash while the STM32H7B3i-DK has 2Mbytes flash I made changes to the mapping_sbsfu.h

file by changing the following entries 

/* LOADER code region */
#define LOADER_REGION_ROM_START             0x08018000    (Previously was 0x08020000)  
/* Aligned LOADER end at the end of the 32Kbytes block for WRP protection */
#define LOADER_REGION_ROM_END               0x0801FFFF    (Previously was 0x08027FFF)

Before I made the above change to the mapping_sbsfu file change I was not able to load my code at all with either Keil or STM32CubeProgrammer but with the changes I can now load the code but unfortunately does not run. 

When I was using the STM32H7B3i-DK I can load the binary image using STM32CubeProgrammer and see the programming running by seeing the debug print statement with the Virtual Com port using Tera-term.

When I attempt to run I get the following error 

Cannot access Memory
*** error 122: AGDI: memory read failed (0xFFFFFFFE)
Cannot access Memory
Cannot access Memory
Cannot access Memory
Cannot access Memory

1 REPLY 1
Jocelyn RICARD
ST Employee

Hello,

The H7Bx has some constraints related to the write protection.

You protect by group of 32KB

Also, you have a sector size of 8KB (granularity for flash erase)

on STM32H7B0, you have 16 sectors of 8KB, and 4 possible write protect areas.

The SBSFU occupies the first 64KB.

Then you need to have the loader and the header of active application in the remaining 64KB.

In SBSFU 2.3.0, the loader was put just after the SBSFU and the header at beginning of next 128KB flash.

So, in that case, only header should be moved inside the 128KB.

Setup would be 64 KB : SBSFU (WRP) / 32KB :Loader (WRP) / 32KB : Header (no WRP)

In SBSFU 2.4.0, the header is now put just after the SBSFU (at 0x08018000) to benefit from the secure memory protection mechanism, but out of the WRP limit of the SBSFU.

The loader is put at 0x08020000 because it needs to be write protected.

So, for this version setup should be changed to have:

64KB SBSFU (WRP) / 32KB (Header) no WRP/ 32KB : Loader (WRP)

Some adaptation will be needed for MPU also.

I hope this will help

Best regards

Jocelyn

Best regards

Jocelyn