I am currently working with a SoC based on a Cortex-M7 (r0p1) core. The specific chip is the S32K344 MCU but I doubt I will get anyone who has worked with this chip, so I’ll try to generalize it.
We want to use the MPU available in the chip, which has 16 regions. I downloaded the latest version of FreeRTOS, navigated to the demos folder, and opened the demo application:
I just ordered this board to try to run this demo, but I found something rather interesting.
Under the Source folder of FreeRTOS, there’s no folder for the Cortex-M7 with MPU support, there’s only support for Cortex-M4. The demo application actually uses this M4 port to run on the M7.
I’ve read through the forums that the Cortex-M4 MPU has 8 regions. I want to use this port on my Cortex-M7 chip, with a 16-region MPU.
Is it worth pursuing trying to “add” the 16 region functionality?
What are the downsides of using the M4 port (other than less regions)?
Why is there no support for Cortex-M7 + MPU in the FreeRTOS source yet? There are plenty of chips that use this architecture now, I feel like I’m not the only person asking this
Any help, guidance, and lessons are much appreciated
I have one last question. If I use the MPU port, but decide to use xTaskCreate() with dynamic allocation, is there any overhead added?
In other words, if I do NOT use the MPU functionality, but I do use the MPU kernel port, will there be context switch performance hits, or any other technicalities I should be aware of?
Yes there is a performance hit as the mpu regions are saved and restored even if they are not used. That is faster (a couple of asm instructions) than testing to see if they are used, and needed anyway to clear any mpu regions used by the task being switched out.