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

osPriorityISR priority can be configured by user #96

Closed
CezaryGapinski opened this issue Mar 28, 2024 · 2 comments
Closed

osPriorityISR priority can be configured by user #96

CezaryGapinski opened this issue Mar 28, 2024 · 2 comments

Comments

@CezaryGapinski
Copy link

osThreadNew() and osThreadSetPriority() functions allow to set osPriorityISR:

https://github.com/ARM-software/CMSIS-FreeRTOS/blob/main/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c#L545C1-L548C8

https://github.com/ARM-software/CMSIS-FreeRTOS/blob/main/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c#L720C1-L722C4

Is it correct?

configMAX_PRIORITIES must be set to 56, but priorities in osPriority_t enum are numbered from 0. For current implementation osPriorityISR = 56 might set index outside the priorities array.

@VladimirUmek
Copy link
Collaborator

Hi,

you are right, thank you for reporting this.
Priorities equal or higher than configMAX_PRIORITIES are limited to configMAX_PRIORITIES-1 in FreeRTOS, but mapping to RTOS2 priority defines in not correct.

I'll check again and provide a fix.

VladimirUmek added a commit that referenced this issue Apr 10, 2024
- FreeRTOS handles priorities from 0 to configMAX_PRIORITIES-1
- RTOS2 defines priorities from 1(osPriorityIdle) to osPriorityISR(56)

- Till now RTOS2 passed priorities 1:1 to FreeRTOS, i.e. FreeRTOS priority matched osPriority_t.
  This commit changes priority mapping: FreeRTOS priority is now (osPriority_t - 1).
VladimirUmek added a commit that referenced this issue Apr 10, 2024
- FreeRTOS handles priorities from 0 to configMAX_PRIORITIES-1
- RTOS2 defines priorities from 1(osPriorityIdle) to osPriorityISR(56)

- Till now RTOS2 passed priorities 1:1 to FreeRTOS, i.e. FreeRTOS priority matched osPriority_t.
  This commit changes priority mapping: FreeRTOS priority is now (osPriority_t - 1).
@VladimirUmek
Copy link
Collaborator

The mapping of priorities is now changed, FreeRTOS priority now equals (osPriority_t - 1).
Since this only shifts priority values side effects are not expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants