0

Hello,

I’m trying to declare a far function pointer(32-bit pointer pointing to a function) with RL78 GCC, but I can’t find how to do this.

CC-RL seems to be able to do this by writing like below, so I tried it, but got an error.

Far function pointer declaration in CC-RL:

void (__far* fp)(void);

The  error message I got:

error: expected identifier or ‘(‘ before ‘__far’
void (__far* fp)(void);

Is there any way to declare a far function pointer in RL78 GCC?

 

 

By the way, I tried the other patterns to declare far function pointer and in one pattern I got an internal compiler error.

The code and error message are listed below.

In the example below, the function pointer is declared as a global variable.

When the function pointer is declared as a local variable,  no error message appeared but the pointer pointed to a wrong address.

 

Code:

typedef void (FP)(void);

__far FP* fp;

__attribute__((section(“.far_area”)))   // dummy function is placed at 0x10000
void dummy(void){}

int main(void){
fp = dummy;
fp();
return 0;
}

 

Error message:

In function ‘main’:
internal compiler error: in change_address_1, at emit-rtl.c:1932
}
^
0x62f49c change_address_1
/home/test/rl78/source/trunk/gcc/gcc/emit-rtl.c:1932
0x631b36 change_address(rtx_def*, machine_mode, rtx_def*)
/home/test/rl78/source/trunk/gcc/gcc/emit-rtl.c:1951
0x9e21b7 transcode_memory_rtx
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:3285
0x9e9233 transcode_memory_rtx
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:3852
0x9e9233 rl78_alloc_physical_registers_ro1
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:4091
0x9e9233 rl78_alloc_physical_registers
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:4684
0x9e9ab4 rl78_reorg
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:6384
0x9e9ab4 devirt_pass
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:174
0x9e9ab4 execute
/home/test/rl78/source/trunk/gcc/gcc/config/rl78/rl78.c:208
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <URL:https://gcc-renesas.com/> for instructions.

 

Thanks.

Open Source Tools Support commented