S32k144, to declare a ISR Macro

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

S32k144, to declare a ISR Macro

Jump to solution
1,506 Views
antonio_rodrigu
Contributor II

Hi,

I need to migrate code from EP100 (Code Warrior) to S32k144 (S32DS), 

I need the equivalence in S32DS to the next CW  preprocessor directive, which allows me to generate the name of the ISR function:

#define ISR(isr_name) void interrupt Os_Entry_##isr_name( void )

#define DeclareISR(isr) extern ISR(isr)

More information... 

In CW, I utilized this macro as follows: 

To declare Cat2 handlers in the Interrupt vectors table...

pastedImage_5.png

To define a CAT2 function as follows:

pastedImage_2.png

Any help to continue is really appreciated.

Antonio.

Tags (3)
0 Kudos
1 Solution
1,332 Views
alexanderfedoto
NXP Employee
NXP Employee

You can try this:

#define STRINGIFY(x) #x
#define ISR(NAME) void __attribute__ ((interrupt (STRINGIFY(NAME)))) NAME##_Handler( void )

ISR(SVC)
{
 accumulator += counter;
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So you'll get after preprocessing:

void __attribute__ ((interrupt ("SVC"))) SVC_Handler( void )

View solution in original post

0 Kudos
3 Replies
1,333 Views
alexanderfedoto
NXP Employee
NXP Employee

You can try this:

#define STRINGIFY(x) #x
#define ISR(NAME) void __attribute__ ((interrupt (STRINGIFY(NAME)))) NAME##_Handler( void )

ISR(SVC)
{
 accumulator += counter;
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So you'll get after preprocessing:

void __attribute__ ((interrupt ("SVC"))) SVC_Handler( void )
0 Kudos
1,332 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm not familiar with CW, but ISR handlers are by default defined in startup_S32k144.S assembly source. If you need to use different names - just rename the existing interrupt handler name. 

As a reference you can look at hello_interupts_s32k144  example:

pastedImage_1.png 

Jiri

0 Kudos
1,332 Views
antonio_rodrigu
Contributor II

Thanks for trying but Is not the answer I was looking for.

Antonio.

0 Kudos