S32k144, to declare a ISR Macro

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32k144, to declare a ISR Macro

跳至解决方案
1,553 次查看
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.

标记 (3)
0 项奖励
1 解答
1,379 次查看
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 项奖励
3 回复数
1,380 次查看
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 项奖励
1,379 次查看
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 项奖励
1,379 次查看
antonio_rodrigu
Contributor II

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

Antonio.

0 项奖励