Hi guys,
we use Keil RTX on a M4 core (XMC 4500) which contains a memory protection unit. We want to run some parts of the software in its own memory space. I have found the description about CMSIS-Zone (CMSIS-Zone) which should provide MPU support. In the thread mode multiple processes should be possible.
Questions:
- Does anybody know if this feature is planned for Keil RTX.
- Are there other RTOSs which support this kind of features already?
Thanks a lot for any hint
Jussy
Hi Ghantaz,
I apologize that this MPU feature in RTX5 is not yet finally documented. We decided not to add it to the official documentation as long as its in beta stage. Please be aware that the hook might change in a future release of RTX5.
In the current implementation is a simply function you can implement anywhere in your use code. This function, as you already mentioned correctly, is called in RTX5 scheduler context right before jumping back to thread mode and executing the next threads code. The parameter given to that hook function is the thread id aka osRtxThread_t* (pointer to the next threads control block). You can use it to identify the thread that will be executed. Its up to you to configure the MPU accordingly.
Please be aware that in Armv8-M devices you have two separate MPUs, one for secure and one for non-secure mode. Typically I expect you to run RTX5 for non-secure mode. Hence you should implement the hook to reconfigure the non-secure MPU using ARM_MPU_Load function for instance. The ARM_MPU_Load_NS function can only be used in secure mode to reconfigure the non-secure MPU.
Does this make sense to you?
Cheers,
Jonatan
Hi,
Thank you. I figured that out and it seems to work. The current issue I am facing is that I get a hard fault while enabling the MPU (I think at __ISB()) if I don't set the PRIVDEFENA bit. I noticed the FreeRTOS implementation seems to always set it when enabling the MPU. Is their any reason why this needs to be done?
Thanks
that depends on your MPU configuration. The PRIVDEFENA allows privileged access to all memory without specific region definition. If you don't enable that bit you would need to add specific region configuration for all your (privileged) code/data, explicitly. In CMSIS this decision is not made implicitly like it might be done in FreeRTOS. You rather need to set this bis explicitly during MPU enable if you want to.
Hi Jonatan,
I realise this thread is a few years old, but I was wondering if the "osRtxMpuLoad" hook is a supported feature of FuSa RTX RTOS? Are there any plans to extend the MPU support in FuSa RTX?
Many thanks
Peter