cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU User Application integration

dominik
Senior

Hi

I'm working on a ST STM32G474RE with the 2 Images and have a application with STM32CubeMX.

I was reading the AN5056 but don't understand how I can build my application bin file to download with the Y-modem protocol. Or do I need to modify and add all my code to the "2_Images_UserApp" Application? This application is already using HAL Libs and in this case I need to add all my code to this project? Is there any example code or step by step instruction to do the implementation?

Best Reagrds, Dominik

4 REPLIES 4
Jocelyn RICARD
ST Employee

Hello Dominik,

you can do either ways.

If you merge your code with the example and keep user example structure, you should be able to reuse the build scripts as is.

If you want to keep your application in another place, you need to

1) Setup your linker to place your application at right address in flash

2) Add the specific area to force 16 bytes alignment of the generated binary (reuse what is provided in linker file of example)

3) Change the VTOR value as well to match the base address of application.

4) Rework the postbuild script to adapt to your directory structure.

5) add in your code the update part that downloads and flashes the new binary before reseting to perform actual update

Best regards

Jocelyn

Hi Ricard

Thanks for your answer.

In case of merging my code in the example structure, is it possible to use the USART for the Y-Modem protocol for firmware update and also with DMA functions for my application? I like to build my DMA init structure with the STM32CubeMX. In this case, I need to merge a lot of things in the COM_Init and in the HAL Layer. But at the End, I think this is the "easier" solution or what do you think? I'm talking about all security functions and vector tables to set in my own project to be compatible with the SBSFU Bootloader which will be tricky. Do you now if there is an example to do one of these ways?

Best Regards, Dominik

Jocelyn RICARD
ST Employee

Hello Dominik,

I would advise not to mix things if possible.

If you have an update trigger, then Deinit the UART in your application before launching the update procedure.

Then, call COM_Init available in the example to re-init the UART to be used for the update.

Best regards

Jocelyn

Ok, I will try. I used the generated code from CubeMX and updated the code from SBSFU and its running, Now i will replace the USART reading by IRQ and DMA functions, but I was able to implement the generated HAL Files without errors, so I'm on the right way. Thanks for your inputs and have a nice weekend