cancel
Showing results for 
Search instead for 
Did you mean: 

Stack corruption on first FPU access after starting application from SBSFU

RKarj.1
Associate

I have an issue with stack corruption on the first FPU access (specifically vmov instruction) after jumping to the application code from SBSFU. I noticed that when the application starts the LSPACT bit is set in FPCCR register. Clearing the bit in startup code (in application) fixes the stack corruption and application starts correctly.

My questions are:

  1. is this correct fix for the issue?
  2. SystemInit function enables the FPU. Should it also do some other initialization for it (like clearing the aforementioned bit)?
  3. should SBSFU do something to the FPU configuration before jumping to the application?

I'm using STM32H7 MCU. SBSFU is based on an example project from SBSFU package. Application uses standard startup code from STM32Cube

3 REPLIES 3
Bubbles
ST Employee

Hello @RKarj.1​ ,

It's a known experience that ARM FP lazy state preservation may sometimes cause problems. Are you using a dual core H7 MCU?

I believe deactivating it may be a good idea in this case. SBSFU will probably not deactivate this optimization by default. Changing the configuration in modified systeminit is probably best way to solve the problem.

Rgds,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @JHOUD​,

thanks for information. I'm using a single core H7 MCU. Is there some other things to take into account when using dual core MCU?

Br. R

Hi @RKarj.1​ ,

a lot of things must be considered for a dual core. But I hope they are all already documented.

I'm SBSFU oriented, but this FPU issue looks like something that can manifest even in other SW environment, not limited to SBSFU. I'll follow it internally with system oriented colleagues.

Thanks for reporting the issue.

J.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.