2023-05-15 11:59 AM
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!
2023-05-15 01:33 PM
> 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.
2023-05-15 02:21 PM
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..