50
CHAPTER 9
OS_MPU_ExtendTaskContext()
OS_Delay(
100
);
}
}
9.8 OS_MPU_ExtendTaskContext()
OS_MPU_ExtendTaskContext()
extends the task context for the MPU registers which means
it saves and restores the MPU settings.
When the task gets deactivated the MPU task context extension performs the following
actions:
• Disable and clean/invalidate data and instruction cache (only when cache is available)
• Disable the MPU
• Save all MPU register values to the task stack
• Set MPU register values to zero, thereby disabling all MPU regions (only in embOS debug
build)
• Enable data and instruction cache (only when cache is available)
When the task gets activated again the MPU task context extension performs the following
actions:
• Disable and clean/invalidate data and instruction cache (only when cache is available)
• Restore the MPU register values from the task stack
• Enable the MPU
• Enable data and instruction cache (only when cache is available)
9.9 MPU types
embOS-MPU supports different MPU implementations with and without cache. These defines
can be used with
OS_MPU_EnableEx()
.
OS_MPU_Enable()
uses
OS_ARMv7M_MPU_API
.
Core
Define
ARMv7-M (Cortex-M0+/M3/M4/M4F)
OS_ARMv7M_MPU_API
ARMv7-M with Cache (Cortex-M7/M7F)
OS_ARMv7M_CACHE_MPU_API
Kinetis K66
OS_KINETIS_MPU_API
Example:
int
main(
void
) {
//
// Initializes the MPU for Cortex-M0+/M3/M4/M4F
// This is the same as OS_MPU_EnableEx(OS_ARMv7M_MPU_API);
//
OS_MPU_Enable();
}
int
main(
void
) {
//
// Initializes the MPU for Cortex-M7/M7F
//
OS_MPU_EnableEx(&OS_ARMv7M_CACHE_MPU_API);
}
9.10 Buffer for MPU sanity check
Each task for which a MPU sanity check should be performed needs a buffer which holds a
copy of the MPU register. The size of the buffer depends on the actual MPU hardware. The
following defines can be used for defining the buffer:
embOS-MPU for Cortex-M and IAR
© 2010-2020 SEGGER Microcontroller GmbH
Содержание embOS-MPU
Страница 4: ...4 embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 6: ...6 embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 21: ...Chapter 4 CPU and compiler specifics embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 44: ...Chapter 8 VFP support embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...