Skip to main content
Associate II
Feb 28, 2024 10:13 AM UTC
Question

Custom bootloader in SBSFU in STM32H753

Hi Team,

 I am trying to add a Secondary/custom bootloader in SBSFU. But not able to figure it out how to do it. I changed memory for active slot area and used the same area for custom bootloader in both linker file of both SBSFU and custom bootloader application. But does not work as expected. Can you please guide me through this? 

I need to add a Custom bootloader and trigger user application from it. What are the modification that I need to do for this. I am using STM32H753 board.

@Jocelyn RICARD 

This topic has been closed for replies.

13 replies

Associate II
Mar 7, 2024 6:50 AM UTC

Any update on tis topic?

 

Jocelyn RICARD
ST Employee
Mar 11, 2024 5:41 PM UTC

Hello @ranganath_b_rangaramu;,

please have a look to STM32H750B-DK example:

Projects\STM32H750B-DK\Applications\2_Images_ExtFlash\

It contains a loader application. It addressed external flash but you should be able to adapt it for your own need

Best regards

Jocelyn

Associate II
Mar 12, 2024 6:25 AM UTC

Hi @Jocelyn RICARD ,

       Thank you. As per my understanding, Standalone loader is used to load a user app application via YModem ?

Here in my case. I need to have a custom bootloader and use that custom bootloader to trigger my user application. 

Jocelyn RICARD
ST Employee
Mar 12, 2024 9:41 AM UTC

Hi @ranganath_b_rangaramu ,

yes the example code uses Ymodem.

Then it is up to you to adapt it with another communication protocol.

You can see that Ymodem protocol is using 2 callback.

LOADER_YMODEM_HeaderPktRxCpltCallback : when first packet was received

LOADER_YMODEM_DataPktRxCpltCallback : when following packets are received

These callbacks show you how to manage incoming data and write them into flash.

Best regards

Jocelyn

Jocelyn RICARD
ST Employee
Mar 19, 2024 5:40 PM UTC

Hello @ranganath_b_rangaramu ,

the standalone loader is supposed to be located just next SBSFU, reason why you have:

#if (SECBOOT_LOADER == SECBOOT_USE_STANDALONE_LOADER)
/*!< Last sector of LOADER ROM area */
#define SFU_PROTECT_WRP_PAGE_END_1 ((uint32_t)((LOADER_REGION_ROM_END - FLASH_BASE) / (FLASH_SECTOR_SIZE)

So, you should be able to locate your standalone loader in the same sector as SBSFU.

SBSFU does not provide ability to update the STANDALONE loader.

Best regards

Jocelyn

Associate II
Mar 22, 2024 5:25 AM UTC

Hi @Jocelyn RICARD ,

      Thank you. 

So as per linker file, 

1. the standalone loader is supposed to be located just next SBSFU - 0x0801FFFF + 1 would be starting address for standalone loader? 

2. Yes, we want to update standalone loader from SBSFU. In this case, what we can do? 

Like Update only Standalone loader by having a separate binary. Or any other suggestion if we have choice to update it?

 

Jocelyn RICARD
ST Employee
Mar 22, 2024 8:54 AM UTC

Hello @ranganath_b_rangaramu ,

yes, standalone loader is supposed to be located just after SBSFU so that write protection can be applied on the whole area.

So, in the example, yes the loader is not supposed to be updated.

If you want to have an updatable loader, you can use the multislot capability.

You put the loader in a second active slot (Application firmware stays in the master active slot), and you change SBSFU so that it can call this loader upon request.

But I don't have implementation example for that.

Best regards

Jocelyn

Associate II
Mar 22, 2024 9:03 AM UTC

Hi @Jocelyn RICARD ,

         Thanks for suggestions. I will check with changes and update. 

Associate II
Apr 2, 2024 12:01 PM UTC

Hi @Jocelyn RICARD ,

          I am able to build a custom bootloader and this image is verified in SBSFU. 

Now i want to add verification of user application in custom bootloader. How we can achieve this?

 

Jocelyn RICARD
ST Employee
Apr 3, 2024 12:02 PM UTC

Hello @ranganath_b_rangaramu ,

The verification of the user application is the SBSFU task.

The custom loader task is only to download and flash the encrypted/signed application.

Best regards

Jocelyn