While reading the documentation of ARMv6-M, I met for the first time the memory protection unit (which is not that complicated). According to the documentation, there is a register named the MPU_RASR (which stands for "MPU Region Attribute and Size Register") and clearly there is more than one of the register (one for each memory region if I understood correctly). My question is how can I know how many replicas of this registers exists?
(I reached this part of the documentation from the for loop in the ValidateAddress function description - bits(16) size_enable = MPU_RASR[r]<15:0>;
("r" is the iterator)
Asked
Active
Viewed 285 times
1

artless noise
- 21,212
- 6
- 68
- 105

TJR
- 454
- 8
- 24
-
What do you mean by "replicas of this register", exactly? As the manual says, MPU_RASR and MPU_RBAR are used to program whichever region is currently selected by MPU_RNR - it's not really clear what you think is missing there. – Notlikethat Dec 30 '15 at 01:06
-
If you look in page B3-291, you will see that they try to access MPU_RASR in location r (which is what I didn't understand since it is not an array) and take the first two bytes of it, what does r means? – TJR Dec 30 '15 at 01:27
-
1In that context, `r` would seem to just represent the region number in an iteration over all the regions - obviously a RASR value for each region is going to _exist_ independently in some internal state in the MPU, irrespective of the way they are accessed from the programmer's view. The ARM ARM pseudocode is primarily a way of describing to hardware folks exactly the behaviour their implementation must conform to - whilst internal stuff can mostly be referred to in terms of the externally-visible view for consistency, there are times when it inevitably has to diverge a bit. – Notlikethat Dec 30 '15 at 02:05
-
So each region has it's own registers (and there are some RASRs)? – TJR Dec 30 '15 at 15:21
-
Well, each region has to have a base address, a size, and some attributes - these happen to be _represented_ in the operational pseudocode as a banked set of RBAR and RASR registers, and may or may not be implemented as such in hardware, but all that really matters to us programmers is that our software has 3 registers to access: MPU_RBAR for an address, MPU_RASR for a size and attributes, and MPU_RNR to select which region's values are _visible_ in the former two. Unless you're actually designing an MPU, there's no real need to get caught up in implementation details. – Notlikethat Dec 30 '15 at 15:50
1 Answers
1
It should basically be equal to number of areas/spaces that you have partitioned into, and I guess there is a cap on this number in ARM processors

Mohit Choradia
- 11
- 2