cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate our application in SBSFU based solution in stm32u585

Hiren
Associate III

Hello supportTeam,@Bubbles  @Fred 

Part No: STM32U585ZIT

Environment: STMIDE

Details: TFM / SBSFU 

We used the ST-provided SBSFU solution for firmware upgrade purpose.

As per our needs, SBSFU/TFM-Boot and SBSFU/TFM-Loader successfully jump to own created application[ThredX OS based].

Below are the steps I used when integrating my own application with SBSFU.

1. Create Project Name: Application [Enable TrustZone with Thread-X OS In STM32U585ZIT6Q controller]

2. Copy the SBSFU_Appli\STM32CubeIDE\NonSecure\STM32U585AIIX_FLASH.ld and Added in own application non secure folder[output.ld - added prebuild file in secure project properties]

3. Copy the SBSFU_Appli\STM32CubeIDE\Secure\STM32U585AIIX_FLASH.ld and Added in own application secure folder[output.ld - added prebuild file in non-secure project properties]

4. Copy SBSFU_Appli\STM32CubeIDE\Postbuild.sh and Added in own application project repository

5. Update NS address in own application secure-> main.c "#define VTOR_TABLE_NS_START_ADDR NS_CODE_START."

6. Copy SBSFU_Appli\STM32CubeIDE\NonSecure\Application\User\startup_stm32u5xx.c and Added in Own Application repository

7. Copy SBSFU_Appli\STM32CubeIDE\Secure\Application\User\startup_stm32u5xx.c and Added in Own Application repository

8. Successful compile code

9. Generate sign with encrypted .bin file in Binary folder

10. Upload encrypted sign .bin through SBSFU_Loader

11. Reset Trigger

12. We are getting below log after reset

 

Outcome:

LOG:

[INF] signature OK

[INF] Bootloader chain load address offset: 0x1a000

[INF] Jumping to the first image slot.

Result: My own thread X OS-based Application does not work after upgrading firmware through SBSFU_boot and SBSFU_loader.

Observation: Using CubeMX, I generated Bare metal code[own application] through cubeMX and integrated with SBSFU. Therefore, it is able to jump from SBSFU_boot to Application [Without OS], however,

the same operation I performed with a ThreadX OS-based application didn't work.

Please review the above step I have performed for own application[Thread X based application] integration purposes and let me know if I missed anything.

I have attached Own project .IOC File and SBSFU linker folder in this mail.

Thanks

Hiren Rameshbhai Thumar 

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @Hiren,

I would first check if interrupt vector is well setup when entering into main() of application.

After that, debugger is your friend and will help you find where things go wrong

Best regards

Jocelyn

Guillaume K
ST Employee

some hints to run ThreadX application with TFM on STM32U5:

- have a look at question Azure RTOS Integration in B-U585-IOT2A Bootloader ... - STMicroelectronics Community

- have a look at package https://www.st.com/en/embedded-software/x-cube-azure.html . version 2.3.0 gives an example of Azure RTOS / ThreadX application as non-secure application in TFM environment on B-U585I-IOT02A.

- in the threadx project, add #define TX_SINGLE_MODE_NON_SECURE for C compiler and also for assembler files.

- change the STM32 HAL to use a timer different from Systick (which is used by ThreadX). Use TIM6 for example. And configure its interruption with  a priority higher than PendSV interrupt priority 15 (so use 14 for TIM6 for example). See ThreadX application examples in Cube U5 or see X-cube-azure package.