Perhaps this is more of a usage question than a real issue.
I don't understand how to use the CMSIS OS2 wrapper when I have the MPU enabled. I selected the GCC_ARM_CM4_MPU port in FreeRTOS. I added the necessary sections to the linker script, and everything compiles and runs on the hardware.
The problem starts when I create a new task. I noticed that the task creation doesn't use the privileged/unprivileged mode selection.
const osThreadAttr_t test_task_attr = {
.name = "TestTask",
.stack_size = 512,
.priority = osPriorityNormal,
.attr_bits = osThreadPrivileged,
};
osThreadNew(test_task, NULL, &test_task_attr);
|
if (attr->priority != osPriorityNone) { |
|
prio = (UBaseType_t)attr->priority; |
|
} |
|
|
|
if ((prio < osPriorityIdle) || (prio > osPriorityISR) || ((attr->attr_bits & osThreadJoinable) == osThreadJoinable)) { |
|
/* Invalid priority or unsupported osThreadJoinable attribute used */ |
|
return (NULL); |
|
} |
Because of this, the xTaskCreate call fails because the unprivileged mode is selected by default, which is not supported.
|
/* xTaskCreate() can only be used to create privileged tasks in MPU port. */ |
|
if( ( uxPriority & portPRIVILEGE_BIT ) != 0 ) |
Have I configured something incorrectly? Or is MPU support with CMSIS OS2 implemented differently?
Perhaps this is more of a usage question than a real issue.
I don't understand how to use the CMSIS OS2 wrapper when I have the MPU enabled. I selected the GCC_ARM_CM4_MPU port in FreeRTOS. I added the necessary sections to the linker script, and everything compiles and runs on the hardware.
The problem starts when I create a new task. I noticed that the task creation doesn't use the privileged/unprivileged mode selection.
CMSIS-FreeRTOS/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c
Lines 544 to 551 in 26970e1
Because of this, the xTaskCreate call fails because the unprivileged mode is selected by default, which is not supported.
CMSIS-FreeRTOS/Source/portable/Common/mpu_wrappers_v2.c
Lines 1562 to 1563 in 26970e1
Have I configured something incorrectly? Or is MPU support with CMSIS OS2 implemented differently?