Skip to main content
Zoey
Associate III
September 9, 2019
Question

SBSFU + UserApp with FreeRTOS

  • September 9, 2019
  • 2 replies
  • 2104 views

I have implemented an application with FreeRTOS. Now I want to run it as an application with SBSFU. It seemed to have a hard fault in SFU_LL_SB_SRAM_Erase(). It stuck in a place with R15(PC) 0x08008FEC ( The function HardFault_Handler for SBSFU is 0x08008ff2).

I tried to comment SFU_LL_SB_SRAM_Erase() and then it did jump to the application, but still stuck in HardFault_Handler for the application.

My application is a bit big. Its .sfb is 185KB. But it can run correctly alone without SBSFU. I also tried to make my application much smaller, to be 40KB, and then the application can running with SBSFU correctly. So, it seems to be related to the size of the application?

Any idea how to solve the problem? Thanks! 

This topic has been closed for replies.

2 replies

Jocelyn RICARD
ST Employee
September 10, 2019

Hello Zoey,

There is a know issue related to usage of FreeRTOS: The SBSFU does not deactivate the systick before jumping to application.

So, you should first deactivate this systick in SBSFU just before jumping in application.

This should be fixed in next release.

Best regards

Jocelyn

Zoey
ZoeyAuthor
Associate III
September 10, 2019

Thanks, Jocelyn.

I just fixed the systick issue (Add SysTick->CTRL &= ~(SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk); after SFU_LL_SB_SRAM_Erase();) and edited my question a few minutes ago (I though no one had read my question yet. =) ). My problem now is that if I remove some tasks to make the application smaller (40KB), then it worked fine. But with the original 185KB application, it stayed in SBSFU ( from debug it ran into SFU_LL_SB_SRAM_Erase, but not into SysTick->CTRL &= ~(SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk);.

Any clue? Thanks in advance!

Jackie Lee
Visitor II
June 16, 2020

Hi Zoey and Jocelyn,

I seem to be hitting the same issue, able to launch app with small userApp FW, however got hard fault when app is bigger. Could you share the changes in code & UserApp.sct to fix the issue?

thanks in advance!

Zoey
ZoeyAuthor
Associate III
June 16, 2020

The change in .sct is something like this. Have two regions and specify their start address and length.

 APP_SRAM1_region (SB_REGION_SRAM1_START) (SB_REGION_SRAM1_END - SB_REGION_SRAM1_START + 1) {
 .ANY (STACK)
 .ANY (HEAP)
 .ANY (+RW +ZI)
 }
 APP_SRAM2_region 0x10000000 0x8000 {
 .ANY (STACK)
 .ANY (HEAP)
 .ANY (+RW +ZI)
 }

Jackie Lee
Visitor II
June 17, 2020

It fixes the hard fault issue on my board. Thanks for the sharing.