3.3 MPU例子分析
例子在TivaWare安装目录下,examples\boards\ek-tm4c123gxl\mpu_fault,支持多种开发环境,CCS,Keil uVision,GCC等。
This example application demonstrates the use of the MPU to protect a region of memory from access,
and to generate a memory management fault when there is an access violation.
开始之前,建议阅读datasheet2.4节memory model,对memory map有个大概了解,
Table 2-4. Memory Map


3.3.1调用ROM_MPURegionSet()
代码中共设置6个区域,我们以第一个为例,参考SW-TM4C-DRL-UG-2.1.4.178.pdf 19.2.2.9 MPURegionSet
#define FLASH_BASE 0x00000000 // FLASH memory in hw_memmap.h
ROM_MPURegi

本文档详细介绍了在TM4C123G开发板上使用MPU进行内存保护和安全管理的实例,包括MPURegionSet函数的使用,设置内存区域的权限,清除状态寄存器,启用中断,以及中断服务程序MPUFaultHandler的实现。通过示例代码,演示了如何引发并处理MPU故障中断,以确保在访问违规时能够正确响应。
最低0.47元/天 解锁文章
2889

被折叠的 条评论
为什么被折叠?



