STM32F Cortex M4 MPU Crash

Hi, We have been trying to use ARMCM4FMPU port in one of our application. Freertos version is 10.0.0. An unprivileged task always Mem Faults when trying to use a kernel API though mpu_wrappers is elevating the privilege of during kernel execution. When Task calls vTaskDelay(), it crashes inside portYIELDWITHINAPI() though I can see it gets executed when CPU state is in Privilege mode. nPRIV in CONTROL Register is 0 when this yield is called. Any pointers on what could cause this? Regards

STM32F Cortex M4 MPU Crash

Was this a project you put together yourself, or a project we provided? If a project you put together yourself then did you update the linker script (or constants, depending on the compiler you are using) so the memory bounds of the privileged data sections are defined correctly?

STM32F Cortex M4 MPU Crash

This project was put together ourselves. On entry to this task, we are accessing a couple of variables in SRAM whose region is defined as NON PRIVILEGE READWRITE. We are able to read write on this region. After this we are using vTaskDelay() inside which it Mem Faults when it calls portYIELDWITHIN_API(). Even if the variables are disabed and only vTaskDelay() is called on entry inside this task, it faults. void ProcessMainTask(void *arg) //Non Privilege Task { g_NonPrivMemArray[0] = 1; while(1) { vTaskDelay(10); } } It assigns g_NonPrivMemArray[0] with 1, then tries to delay and crashes.

STM32F Cortex M4 MPU Crash

Also, if I use the same application code with Freertos 9.0.0 version avaiable in STMCube it does not crash here. There is not change in application at all. Just replaced RTOS from 10.0.0 to 9.0.0 provided in STMCube.

STM32F Cortex M4 MPU Crash

Does STM32 Cube contain the MPU version of FreeRTOS? I thought it only contained the non-MPU version.

STM32F Cortex M4 MPU Crash

Yes it contains an MPU version also. But it has version 9.0.0 of Freertos. We initially ported 10.0.0 into our application and all our tests have been on this version. So we are hesitant to go back to 9.0.0 as we will have to redo all our tests.