3.6 Interrupt handler

#pragma interrupt/vect and the __interrupt and __interrupt_brk keywords of the CA78K0R are converted into #pragma interrupt/interrupt_brk of the CC-RL.

 

The format of an interrupt function of the CA78K0R is as follows.

#pragma interrupt(vect) interrupt-request-name function-name function-name [Stack-change-specification] [{Stack-usage-specification | No-change-specification | Register-bank-specification}]

or

__interrupt void func() { processing }

__interrupt_brk void func() { processing }

 

The format of an interrupt function of the CC-RL is as follows.

#pragma interrupt [(] function-name [([vect=address][,bank=register-bank][,enable={true|false}])][)]

function-declaration

#pragma interrupt_brk [(] function-name [([bank=register-bank][,enable={true|false}])][)]

function-declaration

 

-

When the interrupt request name exists, #include "iodefine.h" is output.

-

__interrupt is converted into #pragma interrupt and __interrupt_brk is converted into #pragma interrupt_brk.

-

When the interrupt request name is BRK_I, it is converted into #pragma interrupt_brk.

-

"interrupt-request-name" is converted into "vect=address" as a macro that indicates the address. The macro value is defined by iodefine.h.

-

"Register-bank-specification" is converted into "bank=register-bank".

-

Since "Stack-change-specification", "Stack-usage-specification", and "No-change-specification" do not exist in the CC-RL, the CcnvCA78K0R outputs a message and deletes them.

-

When a macro or typedef is used in declaration or definition of an interrupt function using the __interrupt or __interrupt_brk keyword, the function name may be interpreted erroneously. Perform conversion after expanding the macro or typedef in advance.

-

If there is a #pragma directive and a description of an interrupt function using a keyword for the same function, converting both of them into #pragma directives sometimes generates duplicate #pragma directives after conversion and a compile error will occur. In this case, delete the duplicate description.

-

When omitting parameters of a function declaration in which the __interrupt or __interrupt_brk keyword is specified, a compile error will occur in the CC-RL. The void type has to be written as the parameter type.

 

[Examples]

Pattern 1

Before conversion

#pragma vect INTP0 func sp=buff+10 rb1
void func(void) { }

After conversion

#pragma interrupt func(vect=INTP0, bank=RB1)
void func(void) { }

Pattern 2

Before conversion

__interrupt void func(void) { }

After conversion

#pragma interrupt func
void func(void) { }

Pattern 3

Before conversion

#pragma interrupt BRK_I func
void func(void) { }

After conversion

#pragma interrupt_brk func
void func(void) { }

Pattern 4

Before conversion

__interrupt void func1(void), func2(void);

After conversion

#pragma interrupt func1
void func1(void);
#pragma interrupt func2
void func2(void);

Pattern 5

Before conversion

#pragma interrupt INTP0 func
__interrupt func(void);

After conversion

#pragma interrupt func(vect=INTP0)
void func(void);
#pragma interrupt func
void func(void);

Corrective action

Duplicate #pragma directives will cause an error in the CC-RL. Delete one of the #pragma directives.

Pattern 6

Before conversion

typedef void func_t(void);
__interrupt func_t f1;

After conversion

typedef void func_t(void);
__interrupt func_t f1;

Corrective action

A compile error will occur in the CC-RL. Expand typedef or the macro in advance.