‎2019-09-09 06:22 AM
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!
‎2019-09-10 08:08 AM
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
‎2019-09-10 08:20 AM
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!
‎2019-09-11 02:52 AM
Hi Jocelyn,
Now I put the code for disabling systick before SFU_LL_SB_SRAM_Erase(). For my large application (185KB), it now can jump to the application, and the hard fault is caused by __decompress before going to my main(). I found this when debugging (KEIL).
‎2019-09-11 04:13 AM
The problem is solved. The cause is my application needs a large RAM region and the RAM region defined in UserApp.sct did not specify the size of the RAM region. I added the size for SRAM1 and also added a RAM region SRAM2.
Thanks for your help, Jocelyn. =)
‎2019-09-11 04:58 AM
Great! Thank you for your feedback!
‎2020-06-16 05:46 AM
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!
‎2020-06-16 06:28 AM
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)
}
‎2020-06-17 05:29 AM
It fixes the hard fault issue on my board. Thanks for the sharing.