Skip to main content
Associate II
February 28, 2024
Question

Custom bootloader in SBSFU in STM32H753

  • February 28, 2024
  • 5 replies
  • 4336 views

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 

5 replies

Associate II
March 7, 2024

Any update on tis topic?

 

Jocelyn RICARD
ST Employee
March 11, 2024

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
March 12, 2024

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
March 12, 2024

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
March 19, 2024

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
March 22, 2024

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
March 22, 2024

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
March 22, 2024

Hi @Jocelyn RICARD ,

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

Associate II
April 2, 2024

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
April 3, 2024

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