MCUxpresso intrinsic functions for interrupts??

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCUxpresso intrinsic functions for interrupts??

888 Views
joseph_jean-jac
Contributor III

Hello Everyone,

I am in a situation where I need to replace the IAR intrinsic functions for retrieving an interrupt state and restoring an interrupt state. For the IAR compiler, the process is usually something like this:

void function(void) { 
__istate_t  s = __get_interrupt_state();
__disable_interrupt();
/* Do something here. */
__set_interrupt_state(s);

}

Browsing through the forums here, I found that to enable and disable interrupts for MCUxpresso, the following API was used:

__enable_irq()

__disable_irq()

My question is what are the MCUxpresso equivalent for IAR's __get_interrupt_state() and

__set_interrupt_state()? I tried searching through the web and I couldn't find what I was exactly looking for in the MCUxpresso user guide and getting started manuals.

Any help is greatly appreciated, thanks!

0 Kudos
Reply
2 Replies

675 Views
converse
Senior Contributor V

The first thing is that on MCUXpresso, they are not "intrinsics" - they are macros or functions, defined in a header.

Next, I am assuming that as well as moving compiler, I guess that you are also moving MCU. Is this correct? Are you also trying to port code from one MCU to another? Can you confirm, and if so what you are porting from and to? If I've guessed wrong, can you explain exactly what you are trying to do?

0 Kudos
Reply

675 Views
joseph_jean-jac
Contributor III

Yes for compiler I am moving from IAR to MCUXpresso.

For MCU, I am moving from K64 to K65.

Yes I am porting code that was used on K64/IAR to K65/MCUXpresso.

I am working on an interrupt header file that uses thr following functions: __disable_interrupts(), __get_interrupt_state(), and __set_interrupt_state().

According to the IAR compiler module, the above are intrinsic functions. Basically I am trying to find the MCUXpresso equivalent of those IAR intrinsic functions.

However, you just stated MCUXpresso doesn’t have “intrinisics”, instead the functions are defined in a header file. For the K65 I assume that header file is “core_cm4.h”??

In that case the functions I am looking for, would they be the following from “core_cm4.h”: __NVIC_DisableIRQ() to disable interrupts?? And for retrieving and restoring an interrupt state, you mentioned MCUXpresso doesn’t do this?? So instead I would have to enable all interrupts using __NVIC_EnableIRQ()??

I tried including the “core_cm4.h” in the interrupt header file and after compiling, I received a bunch of errors in “core_cm4.h” stating the functions and macros were not declared in scope.

Your help is greatly appreciated!

0 Kudos
Reply