SLAU846B June 2023 – November 2024 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1519 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3519
The memory protection unit (MPU) can be used to check all memory accesses made by the processor against a set of access permission policies which can be defined by the programmer. When used together with the privileged/unprivileged execution modes of the Arm Cortex-M0+, the MPU supports limiting access to certain memory locations to privileged code only. If unprivileged code accesses a nonrestricted region, execution continues as if the MPU was not present. However, if unprivileged code issues an access to a restricted region, a hard fault is generated in the processor. It is also possible to restrict access to both privileged and unprivileged code (no access possible through the processor).
The MPU is configured through memory-mapped registers in the system private peripheral bus (PPB) region. See Table 3-8 for the list of MPU configuration registers. The software development kit (SDK) provided with the devices supports the standard Arm Cortex Microcontroller Software Interface Standard (CMSIS) register access definitions for the MPU.
Because the MPU checks all memory accesses from the processor (including accesses to flash, SRAM, and peripherals), it is well suited for improving reliability and robustness in threaded applications involving an RTOS. The MPU can be used to restrict the memory access of individual threads, including establishing stack boundaries and limiting access to specific peripherals. Key state data used by the RTOS can be protected from modification by unprivileged threads.
The MPU provides a mechanism to partition the device memory map into 8 regions (numbered 0-7) plus a default background region. Each region can be configured with access permissions and memory attributes, and regions can be configured to overlap if desired. In the case of overlapping regions, a memory access to a location existing in multiple regions is subjected to the attributes of the region with the highest number.
When the MPU is not enabled (ENABLE bit is cleared in the MPU_CTRL register), the device uses the default memory map and the CPU has access to the memory map as if the MPU was not present.
When the MPU is enabled for use, access to the vector table and the system control space are always permitted, but access to any other location depends on the following:
Because the Arm Cortex-M0+ is a single-bus CPU architecture, there is no delineation between an instruction fetch and a data access by the MPU. Instructions and data are treated the same.
Address | Register | CMSIS | Description |
---|---|---|---|
0xE000.ED90 | MPU_TYPE | MPU->TYPE | Type register indicating that the MPU is present. |
0xE000.ED94 | MPU_CTRL | MPU->CTRL | MPU control register for enabling and configuring the MPU. |
0xE000.ED98 | MPU_RNR | MPU->RNR | Region select register for using MPU_RBAR and MPU_RASR. |
0xE000.ED9C | MPU_RBAR | MPU->RBAR | Region base address configuration register. |
0xE000.EDA0 | MPU_RASR | MPU->RASR | Region size and memory attributes register. |
For detailed information on the MPU register configuration, see the MPU section of the Arm Cortex-M0+ Devices Generic User Guide.