We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Experts,
In the Memory Protection Unit,
what is the difference between Sub regions and the Overlapping regions ?
What is the typical use case of the MPU and how it helps in building a quality software ?
Regards,
Techguyz
Overlapping regions:
Each region is defined by a base address, a size and some attributes.
If you define multiple regions, it is possible some might overlap. For example:
Region A: Covers 1MB starting at 0x0
Region B: Covers 4KB starting 0x10000
The address range 0x10000-0x10FFF is now covered by both A and B. So which attributes should it use? The overlapping region rules in the PMSA describes how this is resolved.
Sub-regions:
Each region (as long as it's at least 256 bytes) is sub-divided into 8 sub-regions. With an enable bit per sub-region. Effectively allowing you to "poke a hole" in a region. The corresponding addresses are not treated as part of the region. They will either pick-up the attributes of an overlapping region (if there is one), or use the defaults.
Allowing overlapping and sub-regions gives you flexibility, and can in many cases reduce the total number of regions you need to define.
Thanks for the reply martin.