2017-03-09 19:12:48 +08:00
|
|
|
.. _mpu_test:
|
|
|
|
|
|
|
|
Memory Protection Unit (MPU) TEST
|
|
|
|
#################################
|
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
This test provides a set options to check the correct MPU configuration
|
|
|
|
against the following security issues:
|
|
|
|
|
|
|
|
* Read at an address that is reserved in the memory map.
|
|
|
|
* Write into the boot Flash/ROM.
|
|
|
|
* Run code located in SRAM.
|
|
|
|
|
|
|
|
If the MPU configuration is correct each option selected ends up in an MPU
|
|
|
|
fault.
|
|
|
|
|
|
|
|
Building and Running
|
|
|
|
********************
|
|
|
|
|
|
|
|
This project can be built and executed as follows:
|
|
|
|
|
2017-11-10 23:30:36 +08:00
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/mpu/mpu_test
|
|
|
|
:board: v2m_beetle
|
|
|
|
:goals: build flash
|
|
|
|
:compact:
|
2017-03-09 19:12:48 +08:00
|
|
|
|
|
|
|
To build the single thread version, use the supplied configuration file for
|
|
|
|
single thread: :file:`prj_single.conf`:
|
|
|
|
|
2017-11-10 23:30:36 +08:00
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/mpu/mpu_test
|
|
|
|
:board: v2m_beetle
|
|
|
|
:conf: prj_single.conf
|
|
|
|
:goals: run
|
|
|
|
:compact:
|
2017-03-09 19:12:48 +08:00
|
|
|
|
2017-05-10 18:50:24 +08:00
|
|
|
To build a version that allows writes to the flash device, edit
|
|
|
|
``prj.conf``, and follow the directions in the comments to enable the
|
|
|
|
proper configs.
|
|
|
|
|
2017-03-09 19:12:48 +08:00
|
|
|
Sample Output
|
|
|
|
=============
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2019-04-10 11:10:59 +08:00
|
|
|
uart:~$ mpu read
|
|
|
|
***** BUS FAULT *****
|
|
|
|
Precise data bus error
|
|
|
|
BFAR Address: 0x24000000
|
|
|
|
***** Hardware exception *****
|
|
|
|
Current thread ID = 0x20000400
|
|
|
|
Faulting instruction address = 0x80004a8
|
2019-06-19 00:48:38 +08:00
|
|
|
Fatal fault in thread 0x20000400! Aborting.
|