Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RTOS2 priority value mapping (#96) #100

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ARM.CMSIS-FreeRTOS.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Active development...
- Add support for processor affinity to CMSIS-RTOS2 wrapper
- Add memory allocation configuration options to FreeRTOSConfig.h
- Corrected task priority mapping, FreeRTOS priority is now osPriority_t-1
- CMSIS-RTOS2 requires CMSIS:OS Tick component
- Drop support for Arm Compiler 5
- Drop support for CMSIS-RTOS1 API
Expand Down
12 changes: 6 additions & 6 deletions CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,15 +582,15 @@ osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAtt
name,
stack,
argument,
prio,
prio - 1U,
(StackType_t *)attr->stack_mem,
(StaticTask_t *)attr->cb_mem);
#else
hTask = xTaskCreateStaticAffinitySet ((TaskFunction_t)func,
name,
stack,
argument,
prio,
prio - 1U,
(StackType_t *)attr->stack_mem,
(StaticTask_t *)attr->cb_mem,
core_aff);
Expand All @@ -605,7 +605,7 @@ osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAtt
name,
(configSTACK_DEPTH_TYPE)stack,
argument,
prio,
prio - 1U,
&hTask) != pdPASS) {
hTask = NULL;
}
Expand All @@ -614,7 +614,7 @@ osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAtt
name,
(configSTACK_DEPTH_TYPE)stack,
argument,
prio,
prio - 1U,
core_aff,
&hTask) != pdPASS) {
hTask = NULL;
Expand Down Expand Up @@ -722,7 +722,7 @@ osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority) {
}
else {
stat = osOK;
vTaskPrioritySet (hTask, (UBaseType_t)priority);
vTaskPrioritySet (hTask, (UBaseType_t)priority - 1U);
}

/* Return execution status */
Expand All @@ -739,7 +739,7 @@ osPriority_t osThreadGetPriority (osThreadId_t thread_id) {
if ((IRQ_Context() != 0U) || (hTask == NULL)) {
prio = osPriorityError;
} else {
prio = (osPriority_t)((int32_t)uxTaskPriorityGet (hTask));
prio = (osPriority_t)(uxTaskPriorityGet (hTask) + 1U);
}

/* Return current thread priority */
Expand Down
Loading