CMSIS-FreeRTOS icon indicating copy to clipboard operation
CMSIS-FreeRTOS copied to clipboard

CM33 MPU without TrustZone

Open stejcon opened this issue 11 months ago • 2 comments

I am trying to use a CM33 chip that has MPU support but does not have the TrustZone extension. It seems that the PDSC file only supports building v8m MPU support if TrustZone is also enabled. From what I know this isn't a requirement of FreeRTOS. I am trying to build with GCC. When trying to build, I get linker errors from cmsis_os2.o and clib_os.o that a number of functions are undefined e.g. MPU_xTaskGetCurrentTaskHandle, MPU_xTaskGetSchedulerState

Line 1151 has <component Cgroup="Core" Cvariant="Cortex-M Non-Secure MPU" condition="FreeRTOS Core TZ MPU">, but there doesn't seem to be a corresponding "FreeRTOS Core MPU" condition to use the files from Source/portable/GCC/ARM_CM33_NTZ instead of Source/portable/GCC/ARM_CM33

Line 913 has <component Cgroup="Core" Cvariant="Cortex-M" isDefaultVariant="true" condition="FreeRTOS Core CM"> which does use the NTZ files but it doesnt include the mpu wrappers file. Nothing uses Source/portable/GCC/ARM_CM33_NTZ/non_secure/mpu_wrappers_v2_asm.c.

Is there a correct way in a cproject file to enable MPU support with the mpu wrappers without having TrustZone? Adding the mpu wrappers file to the Cortex-M Cvarient works and successfully builds, but I can't imagine that this something someone hasn't tried to do before.

stejcon avatar Feb 26 '25 15:02 stejcon

I don't seem to be able to attach a patch file as a suggested siz, but what works for me, and what I dont think will break other projects, is the following patch:

Image

and similar for CM*_GCC and CM*_IAR.

Is this something that could be worked on and fixed in the near future?

stejcon avatar Mar 07 '25 14:03 stejcon

Hi, thanks for pointing this issue. Apparently with the integration of reworked MPU support in FreeRTOS v8M cores were not added to the pdsc. This will be fixed - most likely v8M cores will be added to the "Cortex-M MPU" variant, which is basically the same as Cortex-M variant with MPU wrappers added.

In the mean time, your workaround is fine.

VladimirUmek avatar Mar 10 '25 11:03 VladimirUmek

Cortex-M MPU variant now supports v8M cores without TrustZone.

VladimirUmek avatar Apr 16 '25 07:04 VladimirUmek