As I understand the MPU region is used to set various memory read/write/execute permission/background/properties. I found few application notes on "Stack memory protection using MPU". Real time usage in the SW layers has more complexity.
1. 13 regions for overall MPU region (actual region req will be higher)
2. Region allocation should be multiples of 2^N. (Some memory partitioning doesn't fit in the boundary)
3. Stack protection for SW involving multiple threads (more than 15 layers)
Is there any way to realize more on the various customization and usage of MPU for Software with more partitions, region sizes, etc.
Point 1: MPU shall be re-programmed on task switch.
Point 2: That's the limit. Change SW to fit into the machine's constraints.
Point 3: Use a 32Byte MPU region for this or a watch point.
Pls clarify what it does meany by "Watch point" for stack protection. Is it same as how debugger sets it.
Right, but only in SW. Check the forum, there is already a thread about this.
I tried to set the breakpoint using the ARM Debug registers but the sequence of programming is not clear.
It works when configured through External Debugger but not when configured through Software itself. Is there any reference for debug registers programming guide or sequence. I found some in TRM but it is not clear.
1 -> Enable Monitor mode by setting bit  in Debug Status and Control Register.
2 -> Disable breakpoint by clearing bit  in Breakpoint Control Registers
3 -> Now program instruction address (word aligned) in Breakpoint Value Registers
4 -> Enable breakpoint by setting bit [2:0] and byte offset in Breakpoint Control Registers
But the readback value shows different value then programmed.
Did you enable access to the debug registers?
// get debug register base address
MRC p14, 0, r2, c1, c0, 0
MRC p14, 0, r1, c2, c0, 0
// enable write access
Oh yeah, that is the issue. After unlocking with signature it works.
techguyz said:that is the issue
Please verify the answer - so that others can see that the issue is resolved:
View all questions in Cortex-R / R-Profile forum