TM4C MPU

TM4C MPU 可定義在一區塊中可分成8個相等的記憶體子區塊
要使用子區塊需使用大於 256 Bytes 大小的區塊
MPU 可用在所有區塊包含以下功能:
  • Location
  • Size
  • Access permissions
  • Memory attributes
而存取禁止區塊會造成記憶體管理錯誤 memory management fault
以下資料參考 TI TM4C LaunchPad Workshop MPU 內容
MPURegionSet() uses the following parameters:
  • Region number to set up
  • Address of the region(as aligned by the flags)
  • Flags
Flags are a set of parameters(OR’d together) that determine the attributes of the region(size | execute permission | read/write permission | sub-region disable | enable/disable)
The size flag determines the size of a region and must be one of the following:
MPU_RGN_SIZE_32B
MPU_RGN_SIZE_64B
MPU_RGN_SIZE_128B
MPU_RGN_SIZE_256B
MPU_RGN_SIZE_512B
MPU_RGN_SIZE_1K
...
MPU_RGN_SIZE_512K
MPU_RGN_SIZE_1M
...
MPU_RGN_SIZE_512M
MPU_RGN_SIZE_1G
MPU_RGN_SIZE_2G
MPU_RGN_SIZE_4G
The execute permission flag must be one of the following:
MPU_RGN_PERM_EXEC       enable the region for execution of code
MPU_RGN_PERM_NOEXEC     disables the region for execution of code
The read/write access permissions are applied separately for the privileged and user modes. The read/write access flags must be one of the following:
MPU_RGN_PERM_PRV_NO_UST_NO - no access in privileged or user mode
MPU_RGN_PERM_PRV_RW_UST_NO - privileged read/write, no user access
MPU_RGN_PERM_PRV_RW_UST_RO - privileged read/write ,user read-only
MPU_RGN_PERM_PRV_RW_UST_RW - privileged read/write ,user read/write
MPU_RGN_PERM_PRV_RO_UST_NO - privileged read-only ,user access
MPU_RGN_PERM_PRV_RO_UST_RO - privileged read-only ,user read-only
Each region is automatically divided into 8 equally-sized sub-regions by the MPU. Sub-regions can only be used in regions of size 256 bytes or lager. Any of these 8 subregions can be disabled, allowing for creation of “holes” in a region which can be left open, or overlaid by another region with different attributes. Any of the 8 sub-regions can be disabled with a logical OR of any of the gollowing flags:
MPU_SUB_RGN_DISABLE_0
MPU_SUB_RGN_DISABLE_1
MPU_SUB_RGN_DISABLE_2
MPU_SUB_RGN_DISABLE_3
MPU_SUB_RGN_DISABLE_4
MPU_SUB_RGN_DISABLE_5
MPU_SUB_RGN_DISABLE_6
MPU_SUB_RGN_DISABLE_7
Finallly, the region can be initially enabled or disabled with one of the following flags:
MPU_RGN_ENABLE
MPU_RGN_DISABLE

資料來源:
http://leapwing.github.io/2016/08/19/tm4c-mpu/































































留言

這個網誌中的熱門文章

python serial 模組使用方法 #1

USB HID 教學 #1(轉載)

USB HID 教學 #2 (轉載)