Skip to main content
Associate III
October 31, 2025
Question

Problems with local structure variables in STM32 with SBSFU

  • October 31, 2025
  • 2 replies
  • 145 views

Hello,
In a project with STM32 using SBSFU in a U575 microcontroller, why can a local variable of type structure within a function cause failures or unexpected behaviour in the secure zone, while a global variable of the same type works correctly?

2 replies

Andrew Neil
Super User
October 31, 2025

What failures are you experiencing?

What makes you think that it is the local structure which causes them? 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
IstillagaAuthor
Associate III
October 31, 2025

When I declare a structure as a local variable within a secure function, the program generates a HardFault. The same structure declared as a global variable works reliably.
I suspect the issue is related to memory allocation on the stack in the secure zone, but if I declare it globally, the problem disappears. Why does this happen?