[Solved] Does GCC for Renesas RL78 v4.9.202201 support sprintf() function?
Does GCC for Renesas RL78 v4.9.202201 support sprintf() function?
Hi, Good day!
This is actually my first post here. I’m just starting with the RL78 and I’m using the following:
e2 studio IDE
GCC for Renesas RL78 v4.9.202201
R5F104ML (RL78/G14 Fast Prototyping Board)
I’m configuring the UART and tried to use sprintf() function. However, this error appears:
Error: No room left for const data- the start address exceeds the mirror area. Please move the .text section from lower address to higher address.
I was thinking maybe it’s just because of the project. So I created a new empty project. Initialized the hardware using the code generator but didn’t used any peripherals. I also disabled the WDT.
As you can see, that is the only code I put in the project but I’m still receiving the error. How can I fix it? How can I move the .text section from lower address to higher address? I tried opening the linker_script.ld file and tried modifying it but it doesn’t just work and I’m a newbie to RL78 so I’m not sure if I’m doing it correctly. I tried reading other topics here and in RenesasRulz and it seems like some can use the sprintf() with GCC. That’s why I’m curious why I can’t use it. I hope you can help me with this problem. Thank you!
Regards,
June
Best answer
Hello,
Thank you for reaching out to us!
You were on the right track, the linker script needs to be modified. Here is an example on how you can move the .text section after .rodata section.
This below is the linker script with no modifications:
.text (. + __romdatacopysize): { ... } > ROM PROVIDE(__rl78_abs__ = 0); .init : { ... } > ROM .fini : { ... } > ROM .got : { ... } > ROM PROVIDE(__mirror = 0x3000); PROVIDE(__mirror_end = __mirror + 3840); PROVIDE(__rodata = ADDR (.rodata)); .rodata MAX(., 0x3000): { ... } > ROM .frodata : { ... } > ROM
This below is the linker script with modifications:
PROVIDE(__rl78_abs__ = 0); .init (. + __romdatacopysize): { ... } > ROM .fini : { ... } > ROM .got : { ... } > ROM PROVIDE(__mirror = 0x3000); PROVIDE(__mirror_end = __mirror + 3840); PROVIDE(__rodata = ADDR (.rodata)); .rodata MAX(., 0x3000): { ... } > ROM .text : { ... } > ROM .frodata : { ... } > ROM
Adding the (. + __romdatacopysize) in the .init sections ensures enough space for initialization. Details about the linker script and the linker in general may be found here:
<GCC for Renesas RL78 toolchain install location>/Doc/ld.pdf
Please let us know if we can be of further assistance.
__
Best regards,
The Open Source Tools Team