Hello,
I am trying to enable the MPU for RT1040 and configure a couple of sections of the RAM as non-executable. I am unable to find the relevant document / example code to be able to configure the MPU for this chip. From this link https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/TEE-for-ARM-Cortex-M7-based-MCU/td-p/1753242, I got information about the “tee_fault” example in “SDK_2_16_000_MIMXRT1160-EVK” and learned about the McuXpresso Config TEE tool. But this tool is not supported for RT1040.
So, my questions are:
Thanks
Hi @rd24
- Firstly, I would like to share the dedicated application note about the cache system that includes the L1 cache, memory
types, attributes and MPU (Memory Protection Unit) https://www.nxp.com/docs/en/application-note/AN12042.pdf
- There are no any dedictaed examples about MPU feature, but you can understand from below sample code in many examples.
MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 1, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);
/* Enable MPU */
ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk | MPU_CTRL_HFNMIENA_Msk);
Hi @Sam_Gao,
Thanks for your quick reply. I have checked the BOARD_ConfigMPU() function from the hello_world example and understood the MPU configurations. I understand that after configuring and enabling the MPU, if an access is made to a region without the right permissions a MemManage fault is raised. Is there a handler for the MemManage fault? Is there an example code which demonstrates this scenario?
Thanks
Hi @rd24
1. About SDK of I.MX RT1040, please download from https://mcuxpresso.nxp.com/en/builder?hw=MIMXRT1040-EVK which supports our nxp.com/i.mxrt EVK board for reference.
2. About MPU configuration, you can refer anyone of examples (e.g, helloworld) in source/xx.c
reference code like below, `BOARD_ConfigMPU` function is for configration when doing init board hardware.
int main(void)
{
char ch;
/* Init board hardware. */
BOARD_ConfigMPU();
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();
/* Just enable the trace clock, leave coresight initialization to IDE debugger */
SystemCoreClockUpdate();
CLOCK_EnableClock(kCLOCK_Trace);
PRINTF("hello world\r\n");