Using a memory protection unit (MPU)
A memory protection unit (MPU) continuously monitors memory access at a hardware level to make absolutely certain that only legal memory accesses are occurring. Otherwise, an interrupt is raised and immediate action can be taken. This allows many common errors to be immediately detected, which might otherwise go unnoticed for a period of time.
Problems like stack-overflows can be immediately caught when using an MPU, e.g., a stack growing into the memory space reserved for another task. Buffer overflows and pointer errors are also stopped dead in their tracks when an MPU is utilized, which makes for a more robust application.
The STM32F767 MCU includes an MPU. In order to make use of the MPU in FreeRTOS, the MPU-enabled FreeRTOS port must be used: GCC\ARM_CM4_MPU
. (The book’s example-programs do not use this port.) This way, restricted tasks can be created by using the API xTaskCreateRestricted
, which contains the following additional...