How to declare far function pointer with GNURL78
How to declare far function pointer with GNURL78
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.
Hello,
Thank you for reaching out to us!
GCC for Renesas RL78 does not support far functions. If support for them is needed, we recommend trying out LLVM for Renesas RL78.
Please let us know if we can be of further assistance.
Best regards,
The Open Source Tools Team
Hello,
Thank you for replying.
For a certain reason, I must use Red Hat Enterprise but LLVM for Renesas RL78 only supports Ubuntu.
Is there any plan to support this Linux distribution?
Thanks.
Hello,
Thank you for reaching out to us!
The portable Linux version of LLVM for Renesas RL78 can be tried out on RHEL:
https://llvm-gcc-renesas.com/downloads/download.php?f=rl78/10.0.0.202306/llvm-10.0.0.202306-rl78-elf.tar.gz
Please note that the current build depends on the “ncurses” library(version 5, x86_64). If the given RHEL distribution is using a newer version of the library, the old version can be installed by:
$ > yum install ncurses-compat-libs
(verified on Red Hat Enterprise Linux release 8.1 (Ootpa))
Please let us know if we can be of further assistance.
__
Best regards,
The Open Source Tools Team