Renesas RL78 port

ChibiOS public support forum for topics related to the Renesas RL78 family of micro-controllers.

Moderators: lbednarz, DeusExMachina

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: Renesas RL78 port

Postby DeusExMachina » Sun Aug 17, 2014 3:29 pm

I used linux, tomorrow I'll check windows environment.
Also I plan to use free Renesas e2studio (Eclipse-based) for debug, so we'll receive full development environment for Windows

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: Renesas RL78 port

Postby DeusExMachina » Wed Aug 20, 2014 12:34 am

2lbednarz
I checked my makefile in Windows, and it worked for me.
But before I received the same errors as you, and this errors were related to broken compiler and make environment.
So, first we should be aware of using make from yagarto tools. If you use 64bit windows and receive heap allocation errors, may be you have to rebase msys-1.0.dll using ReBase.exe from Visual Studio:

Code: Select all

rebase -b 0x30000000 msys-1.0.dll

After checking that make is OK (for ex. compiling some ARM Chibios projects) we need to place libstdc++-6.dll and libgcc_s_dw2-1.dll to the same directory with make. rl78-elf-gcc needs these files to be located in the same directory with make!
Of cause this directory must be in $PATH system variable.
(Don't use make provided with rl78-elf toolchain)
So, my yagarto-tools dir looks like this:

Code: Select all

07/07/2006  03:45 AM            18,349 copying.txt
07/07/2006  04:00 AM            74,240 cp.exe
07/08/2006  10:54 PM               163 echo
11/22/2013  03:17 PM           108,032 libgcc_s_dw2-1.dll
11/22/2013  03:17 PM           879,630 libstdc++-6.dll
07/07/2006  04:00 AM           180,736 make.exe
07/07/2006  04:00 AM            28,672 mkdir.exe
12/05/2013  11:50 AM           781,616 msys-1.0.dll
05/13/2010  10:26 PM            55,112 ReBase.Exe
07/07/2006  04:00 AM            62,464 rm.exe
07/07/2006  04:00 AM           476,672 sh.exe
10/19/2006  02:19 AM               709 source.txt
07/08/2006  10:54 PM            38,400 touch.exe

After you obtain valid make environment you can easily compile RL78 demo. (Please update to last github version)
Now it works OK :lol:
Next step is to setup of debugging in E2Studio.

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: Renesas RL78 port

Postby lbednarz » Wed Aug 20, 2014 8:37 am

Hmm... too many things to do for me:)
I think, that tools provided by rl78 toolchain can work using sh.exe, but I've installed it in path with spaces (Program Files) and sh.exe seems to not accept that.

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: Renesas RL78 port

Postby lbednarz » Wed Aug 20, 2014 12:12 pm

I've found that vectors.c, chcore.c and R5F100xE.ld are not included in compilation. Look at ARMCMx rules.mk file, there is "-T$(LDSCRIPT)" in LDFLAGS.
If you remove "-Wl,--relax -Wl,--gc-sections" from rules.mk LDFLAGS, you can see, that there are linking errors.

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: Renesas RL78 port

Postby DeusExMachina » Thu Aug 21, 2014 12:41 am

lbednarz wrote:I've found that vectors.c, chcore.c and R5F100xE.ld are not included in compilation. Look at ARMCMx rules.mk file, there is "-T$(LDSCRIPT)" in LDFLAGS.
If you remove "-Wl,--relax -Wl,--gc-sections" from rules.mk LDFLAGS, you can see, that there are linking errors.

Fixed

Code: Select all

rl78-elf-gcc ../../os/ports/GCC/RL78/crt0.o ../../os/ports/GCC/RL78/chcore.o ../../os/ports/GCC/RL78/vectors.o ../../os/kernel/src/chsys.o ../../os/kernel/src/chdebug.o ../../os/kernel/src/chlists.o ../../os/kernel/src/chvt.o ../../os/kernel/src/chschd.o ../../os/kernel/src/chthreads.o ../../os/kernel/src/chdynamic.o ../../os/kernel/src/chregistry.o ../../os/kernel/src/chsem.o ../../os/kernel/src/chmtx.o ../../os/kernel/src/chcond.o ../../os/kernel/src/chevents.o ../../os/kernel/src/chmsg.o ../../os/kernel/src/chmboxes.o ../../os/kernel/src/chqueues.o ../../os/kernel/src/chmemcore.o ../../os/kernel/src/chheap.o ../../os/kernel/src/chmempools.o ../../test/test.o ../../test/testthd.o ../../test/testsem.o ../../test/testmtx.o ../../test/testmsg.o ../../test/testmbox.o ../../test/testevt.o ../../test/testheap.o ../../test/testpools.o ../../test/testdyn.o ../../test/testqueues.o ../../test/testbmk.o ../../os/hal/src/hal.o ../../os/hal/src/adc.o ../../os/hal/src/can.o ../../os/hal/src/ext.o ../../os/hal/src/gpt.o ../../os/hal/src/i2c.o ../../os/hal/src/icu.o ../../os/hal/src/mac.o ../../os/hal/src/mmc_spi.o ../../os/hal/src/mmcsd.o ../../os/hal/src/pal.o ../../os/hal/src/pwm.o ../../os/hal/src/rtc.o ../../os/hal/src/sdc.o ../../os/hal/src/serial.o ../../os/hal/src/serial_usb.o ../../os/hal/src/spi.o ../../os/hal/src/tm.o ../../os/hal/src/uart.o ../../os/hal/src/usb.o ../../os/hal/platforms/RL78/hal_lld.o ../../os/hal/platforms/RL78/serial_lld.o ../../boards/RENESAS_YRPBRL78G13/board.o main.o  -nostartfiles  -T ../../os/ports/GCC/RL78/R5F100xE/ld/R5F100xE.ld   -o ch.elf
rl78-elf-objcopy -O ihex ch.elf ch.hex
rl78-elf-objcopy -O binary ch.elf ch.bin
rl78-elf-objdump -x --syms ch.elf > ch.dmp
rl78-elf-size ch.elf
   text      data       bss       dec       hex   filename
  32905       214      2228     35347      8a13   ch.elf

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: Renesas RL78 port

Postby DeusExMachina » Tue Aug 26, 2014 3:33 am

I recompiled using last version of gcc (v14), and noticed that size decreased significantly (as promised).
BTW, we need only these options to receive optimized by size program:

Code: Select all

-ggdb -mmul=rl78 -std=gnu99 -fdata-sections -ffunction-sections -Os

all other options are included by default selecting Ox level.
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

lbednarz
Posts: 32
Joined: Sat Dec 18, 2010 11:36 am
Location: Poland

Re: Renesas RL78 port

Postby lbednarz » Tue Aug 26, 2014 6:44 am

Can you give more details? What is the binary size comparing to previous compiler version?

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: Renesas RL78 port

Postby DeusExMachina » Thu Sep 04, 2014 2:22 pm

I received 3% less code size for 14.2 version. But I find critical problem - generated code for massive arithmetic operations bloats tremendously - 3 times more than IAR. Just adding several floating points operations increase code size for 7-8K. Unacceptable... I think for RL78 Chibios should be ported using IAR... :|


Return to “RL78 Support”

Who is online

Users browsing this forum: No registered users and 3 guests