Friday, May 25th 2018, 10:52am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.



Date of registration: Jul 17th 2008

Posts: 77

Location: San Francisco Bay Area

Occupation: Embedded Systems Engineer


Thursday, January 11th 2018, 4:00am

[SOLVED] OS_EnterInterrupt/OS_EnterNestableInterrupt on Cortex-M

I have two timer interrupts which both use OS_Enter/OS_LeaveInterrupt. One has a higher priority than the other. Both are at lower priorities (higher values) than the fast interrupt. My understanding is that these routines disable interrupts that are not so-called fast interrupt. Using a scope I set two GPIOs high when entering these routines and low when leaving. I can clearly see the lower interrupt preempted by that with the higher priority.

From the Cortex-M EMBOS manual:


OS_EnterInterrupt() has to be used as prolog function, when the interrupt handler should not be preempted by any other interrupt handler that runs on a priority below the fast interrupt priority. An interrupt handler that starts with OS_EnterInterrupt() has to end with the epilog function OS_LeaveInterrupt().
From the RTOS header files where the macros are defined:


#define OS_ENABLE_INTS_SAVE_IPL() // Not required with Cortex-M, avoid call of OS_EI()
Are OS_EnterInterrupt and OS_EnterNestableInterrupt effectively the same on Cortex-M? Why is my interrupt above being preempted?


Super Moderator

Date of registration: Nov 14th 2007

Posts: 272


Thursday, January 11th 2018, 9:25am

Hi Kenny,

OS_EnterInterrupt() disables interrupts with setting BASEPRI register to 0x80 which disables all embOS interrupts.
OS_EnterNestableInterrupt() does not change the BASEPRI register and therefore does not disable interrupts.


Are OS_EnterInterrupt and OS_EnterNestableInterrupt effectively the same on Cortex-M?

Yes, they also work with Cortex-M. The macro is not necessary in all embOS ports.
The interrupt handler could be preempted before OS_EnterInterrupt() is actually called but that's no problem for embOS and usually no problem for the application.

Best regards,