cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Facing when we Integrated My Own application (ThreadX enable) with SBSFU.

HirenThumar2702
Associate III

Hi ST Support Team,

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.

Thanks

Hiren Rameshbhai Thumar

+91-9426570128

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello @HirenThumar2702,

One thing you didn't do is to copy the system*.c file that define the SAU regions.

But if it works with bare os application is should work also with ThreadX.

Now did you check interrupts were working fine in bare OS application.

Are both applications configured the same way ?

Only way to know is to find exactly where it fails.

This can take time...

Best regards

Jocelyn

Hi Jocelyn,

Thanks For your message. 

1. Yes I have checked " TZ_SAU_Setup();" function is called from "SystemInit" and it is available in system_stm32u5xx_s.c

2.  Without OS based own application ( bare OS application) is working but ThreadX OS-based application is not working

3. Yes for both applications (TheadX OS and without OS ), i am using the same configuration of SBSFU-BOOT and the same linker folder used.

4. When I attempted to debug a threadx OS-based application, I observed that the SBSFU-bootloader successfully jumped to a secure region but did not jump from a secure region to a nonsecure region. it is going in hard fault

last instruction call Flow Secure region main.c -> void NonSecure_Init(void) -> NonSecure_ResetHandler(); -> Hard Fault

When I checked NonSecure_ResetHandler, it got a null value, indicating that a hard fault would occur, but when I read the entire memory, there were available of non-secure region reset handler address
non-secure reset handler address, however it receives a null value during execution

can you provide me information on which file I need to copy from SBSFU_Appli(Example provided by ST) and change in my own application?

 

Thanks

Hiren R. Thumar