cancel
Showing results for 
Search instead for 
Did you mean: 

How to separate variables using MPU on STM32F429ZI?

CMora.1
Associate

This is kind of a broad question, but I'm having a bit of trouble understanding/finding resources on using the MPU on this MCU. My goal is to partition some of the variables in my code so that they cannot be accessed by accidental writes/overflow, and it seems to me that the best way to do this would be by using the MPU to segment a memory region. I am having trouble understanding how to ensure that specific variables/structs are saved to specific regions in memory. Perhaps I am misunderstanding the purpose of the MPU? Any clarification or resources to look into would be greatly appreciated. Thanks!

2 REPLIES 2
Pavel A.
Evangelist III

> how to ensure that specific variables/structs are saved to specific regions in memory. 

For this you need to layout the data RAM in a way compatible with MPU regions by size and alignment.

Realization depends on your toolchain. For GCC (CubeIDE) you need to create a linker script.

In Keil MDK you can declare data at absolute addresses, IAR linker has even more sophisticated script language.

Should work the same as it does for other CM3, CM4 cores, perhaps look at the ARM docs, or analysis / counter-point from likes of Joseph Yiu..

I don't think it remaps memory, you'd have to have to have large inaccessible guard zones front and back, I'd have thought

Surely there's got to be a better way / approach to what you're attempting..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..