Pular para o conteúdo principal
Renesas Brasil - Knowledgebase

Defining the allocation of all interrupt-vector addresses in a single file (CC-RL)

Last Updated:01/31/2018


I am using the CC-RL compiler for RL78 devices. Can I create an interrupt vector table in the way I describe below?

  1. The vector table address allocation is to be managed in a single file.
  2. The allocation is to be declared obviously. 


In CC-RL V1.04.00 or later, use the .VECTOR directive.

.EXTERN _func1
.EXTERN _func2
.EXTERN _func3
_func1 .VECTOR 0x10
_func2 .VECTOR 0x12
_func3 .VECTOR 0x14

In CC-RL V1.03.00 or earlier, for the .VECTOR directive the symbol name must be defined in the same file.

Yes, you can create an interrupt vector table in the way you describe. Refer to the following instructions.

For the .VECTOR directive, the symbol names must be defined in the same file. For this reason, if you wish to define all of the interrupt vectors in one file and the interrupt processing in another file, you need to use the .DB2 directive.

Note that you need to make some of the settings by hand. The following is an example.

.EXTERN _InterruptFunc
.SECTION .vect, AT 0x00XX ←Vector address
.DB2 _InterruptFunc

The items below are to be set by hand.
If you use the .VECTOR directive even once, you need to use it to define the vector area (0x00000 to 0x0007F) for interrupts.
In the startup routine cstart.asm, the interrupt vector area is defined by the .VECTOR directive relative to the reset vector. Delete (comment-out) this definition and define the area without using .VECTOR directive for the position where the vectors are initially gathered.
(Statement to be deleted)
_start.VECTOR 0

If you specify the vector table with #pragma interrupt or the -DEBUG_MONITOR option of the linker, the output code will be a .VECTOR directive or equivalent. Do not use #pragma interrupt to specify the vector table.
Also, you need to arrange the code for 0xff relative to the address range of the monitor area instead of -DEBUG_MONITOR option.

Debug monitor areas: 0x0002 to 0x0003 and 0x00ce to 0x00d7
.SECTION ocdarea, AT 0x0002
.DB2 0xffff
.SECTION ocdarea, AT 0x00ce
.DB4 0xffffffff
.DB4 0xffffffff
.DB2 0xffff"

Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family