Quality RTOS & Embedded Software

NOTE:This is a read only archive of threads posted to the FreeRTOS support forum. Use these archive pages to search previous posts. New forum support threads can be started at the FreeRTOS forums.

FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services and the community. In return for using our software for free, we request you play fair and do your bit to help others! Sign up for an account and receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum. Use these archive pages to search previous posts. New forum support threads can be started at the FreeRTOS forums.

Exclusive areas and SVC call on Cortex-M0

As the cortex-M0 does not have a BASEPRI register, that means that interrupts can only be globally disabled through the PRIMASK register. But disabling through the PRIMASK register also means that most of the exceptions will be disabled including the SVC exception. The question is as an exclusive area needs interrupts to be globally disabled and inside this exclusive areas there is a usecase in which the SVCcall exception needs to be triggered, what would be the best way to go about doing just that? Are far as I have read , this is not architecturally possible. What can be done is to disable all the interrupts in the NVIC , but that would not be as efficient and can have other side effects and racing conditions.

Exclusive areas and SVC call on Cortex-M0

Not looked for a little while – how would you disable all the interrupts
in the NVIC without having to write to all the enable/disable registers?
Would it be possible for you to pend an interrupt that executes after
you are outside of the exclusive area rather than call SVC?
If you are calling SVC from an exclusive area, and the SVC handler
actually executed, you would need to keep it very short.

Exclusive areas and SVC call on Cortex-M0

By setting the PRIMASK register, which disables the interrupts globally but also disables all the exceptions uptil level 0. Leaving only the reset handler and the Hardfault exception enabled.
No I have to trigger a SVC call.
Yes, the length of the handler is pretty short. The problem is the SVC handler cannot be triggered when the interrupts are globally disabled on the M0 using the PRIMASK register.
Do you know of the top of your head how freertos handles exclusive areas on the M0?

Exclusive areas and SVC call on Cortex-M0

If you know which interrupts are being used then you could replace the
taskENTERCRITICAL() implementation with a macro that disables just
those interrupts, and likes enables them again using taskEXITCRITICAL()
– if the number of interrupts is small enough that might be practical
but I don’t think disabling all interrupts would be fast enough.