Pular para o conteúdo principal
Knowledgebase
Home
Renesas Brasil - Knowledgebase

How to assign the vector table to an arbitrary address?

Latest Updated:06/05/2006

Question:

I want to assign the vector table to an arbitrary address.

Answer:

In H8SX, you can use the VBR register to assign the vector table to an arbitrary address. However, if you have created a workspace in the H8C Compiler environment and are using the auto-create startup code, you won’t be able to assign the vector table to a different address. The reason for this is the startup code uses the _interrupt extension function to automatically create the vector table and locates the vector table starting at address 0.

In order to use the VBR register to locate the vector table at a different address, you will need to create the vector table without using the startup code.


Example:

The startup code defines the following:



<intprg.c>

#pragma section IntPRG

・・・

// vector 4 Illegal code

__interrupt(vect=4) void INT_Illegal_code(void){/* sleep(); */}

・・・



The vector table is automatically created based on this __interrupt extension function.



Therefore, create the vector table as shown in the following example.



<intprg.c>

#pragma section IntPRG

・・・

// vector 4 Illegal code

void INT_Illegal_code(void){/* sleep(); */}

・・・

<vecttbl.c>

#pragma section INTTBL

void *INT_Vectors[] = {

・・・

// 4 Reserved

(void *) INT_Illegal_code,

・・・

After creating the vector table as shown, assign section INTTBL to the specified address space using the VBR.

Suitable Products