Testing GDC (GCC 7.1) on Runtime-less ARM Cortex-M

Mike via D.gnu d.gnu at puremagic.com
Wed Jun 28 04:19:10 PDT 2017


On Tuesday, 27 June 2017 at 17:55:02 UTC, Iain Buclaw wrote:

> Looks like it would be best to apply these PRs in the order 
> listed:
>
> https://github.com/dlang/dmd/pull/5276 
> https://github.com/dlang/dmd/pull/5948 
> https://github.com/dlang/dmd/pull/6418
>

Compiling https://github.com/JinShil/stm32f42_discovery_demo

GDC 7.1 Without https://github.com/D-Programming-GDC/GDC/pull/507
-----------------------------------------------------------------
time arm-none-eabi-gdc -c -O3 -nophoboslib -nostdinc 
-nodefaultlibs -nostdlib -fno-emit-moduleinfo -mthumb 
-mcpu=cortex-m4 -Isource/runtime -fno-bounds-check 
-fno-invariants -fno-in -fno-out -ffunction-sections 
-fdata-sections source/gcc/attribute.d source/board/package.d 
source/board/ILI9341.d source/board/lcd.d source/board/spi5.d 
source/board/statusLED.d source/board/random.d 
source/board/ltdc.d source/stm32f42/bus.d source/stm32f42/scb.d 
source/stm32f42/trace.d source/stm32f42/dma2d.d 
source/stm32f42/spi.d source/stm32f42/pwr.d source/stm32f42/rcc.d 
source/stm32f42/rng.d source/stm32f42/nvic.d 
source/stm32f42/mmio.d source/stm32f42/flash.d 
source/stm32f42/gpio.d source/stm32f42/ltdc.d source/main.d -o 
binary/firmware.o

real    1m14.780s
user    0m53.201s
sys     0m5.704s

time arm-none-eabi-ld binary/firmware.o -Tlinker/linker.ld 
--gc-sections -o binary/firmware

real    0m34.636s
user    0m33.120s
sys     0m1.201s



GDC 7.1 With https://github.com/D-Programming-GDC/GDC/pull/507
--------------------------------------------------------------
time arm-none-eabi-gdc -c -O3 -nophoboslib -nostdinc 
-nodefaultlibs -nostdlib -fno-emit-moduleinfo -mthumb 
-mcpu=cortex-m4 -Isource/runtime -fno-bounds-check 
-fno-invariants -fno-in -fno-out -ffunction-sections 
-fdata-sections source/gcc/attribute.d source/board/package.d 
source/board/ILI9341.d source/board/lcd.d source/board/spi5.d 
source/board/statusLED.d source/board/random.d 
source/board/ltdc.d source/stm32f42/bus.d source/stm32f42/scb.d 
source/stm32f42/trace.d source/stm32f42/dma2d.d 
source/stm32f42/spi.d source/stm32f42/pwr.d source/stm32f42/rcc.d 
source/stm32f42/rng.d source/stm32f42/nvic.d 
source/stm32f42/mmio.d source/stm32f42/flash.d 
source/stm32f42/gpio.d source/stm32f42/ltdc.d source/main.d -o 
binary/firmware.o

real    0m55.745s
user    0m50.962s
sys     0m2.338s

time arm-none-eabi-ld binary/firmware.o -Tlinker/linker.ld 
--gc-sections -o binary/firmware

real    0m33.768s
user    0m33.212s
sys     0m0.503s

PR507 eems to have made a mild improvement.

In an effort to draw a comparison, I modified the code as little 
as possible to get it to build with DMD, and this is the result:
--------------------------------------------------
time dmd -m32 -c -conf= -boundscheck=off -release -betterC 
-Isource/runtime source/gcc/attribute.d source/board/package.d 
source/board/ILI9341.d source/board/lcd.d source/board/spi5.d 
source/board/statusLED.d source/board/random.d 
source/board/ltdc.d source/stm32f42/bus.d source/stm32f42/scb.d 
source/stm32f42/trace.d source/stm32f42/dma2d.d 
source/stm32f42/spi.d source/stm32f42/pwr.d source/stm32f42/rcc.d 
source/stm32f42/rng.d source/stm32f42/nvic.d 
source/stm32f42/mmio.d source/stm32f42/flash.d 
source/stm32f42/gpio.d source/stm32f42/ltdc.d source/main.d 
-of=binary/firmware.o

real    0m3.086s
user    0m2.569s
sys     0m0.517s

Not sure if that's a valid comparison, but that's a huge 
difference.

I'd be glad to do some troubleshooting if you have any ideas.  
But I may not get to it right away as I will be traveling for a 
few weeks.

Mike


More information about the D.gnu mailing list