GDC 9 and ARM Cortex-M

Iain Buclaw ibuclaw at gdcproject.org
Sun May 19 14:17:05 UTC 2019


On Sun, 19 May 2019 at 16:00, Timo Sintonen via D.gnu
<d.gnu at puremagic.com> wrote:
>
> On Sunday, 19 May 2019 at 10:49:51 UTC, Mike Franklin wrote:
> > On Sunday, 19 May 2019 at 06:54:14 UTC, Timo Sintonen wrote:
> >> I am updating my toolset and libraries to GCC/GDC 9.1 release.
> >> First impression is that druntime needs more work than with
> >> previous versions. Many places to change and even compiler
> >> crashes when compiling some files.
> >>
> >> Before I look further I want to ask if there has been any
> >> testing with this target (cross compiler linux->arm-eabi). Is
> >> it expected to work, not to work or not tested at all.
> >
> > Several months ago, I used this script
> > (https://github.com/JinShil/native-gdc/blob/master/native-gdc.sh) to build a native GDC compiler.  I then used that compiler by way of this script (https://github.com/JinShil/arm-none-eabi-gdc/blob/master/arm-none-eabi-gdc.sh) to build an arm-none-eabi cross-compiler from head.
> >
> > I then used that cross-compiler to build this ARM Cortex-M
> > project (https://github.com/JinShil/stm32f42_discovery_demo).
> > Everything worked fine.
> >
> > I don't know if that helps, but that's my experience for
> > whatever it's worth.
> >
> > Mike
>
> As we know there is always three possible sources of failure:
> - the compiler sources may have a bug
> - my local tools (gcc binutils etc) may build a buggy compiler
> - my use of the built compiler is wrong (compiler flags etc)
>
> This is what I currently use to build the compiler. C compilers
> built with this are used in production.
>
> cat >file <<EOF
> MULTILIB_OPTIONS  +=
> mcpu=cortex-m0/mcpu=cortex-m0plus/mcpu=cortex-m3/mcpu=cortex-m4/mcpu=cortex-m7  mfloat-abi=hard mfpu=fpv4-sp-d16 mfpu=fpv5-sp-d16
> MULTILIB_DIRNAMES += cortex-m0 cortex-m0plus cortex-m3 cortex-m4
> cortex-m7 hardfp fpv4 fpv5
> MULTILIB_REQUIRED += mcpu=cortex-m0
> MULTILIB_REQUIRED += mcpu=cortex-m0plus
> MULTILIB_REQUIRED += mcpu=cortex-m3
> MULTILIB_REQUIRED +=
> mcpu=cortex-m4/mfloat-abi=hard/mfpu=fpv4-sp-d16
> MULTILIB_REQUIRED +=
> mcpu=cortex-m7/mfloat-abi=hard/mfpu=fpv5-sp-d16
> MULTILIB_EXTRA_OPTS += mthumb
>
> EOF
> cp file gcc/gcc/config/arm/t-arm-elf
>
> rm -rf build-gcc
> mkdir build-gcc
> cd build-gcc
>
> ../gcc/configure --disable-bootstrap --disable-nls
> --disable-werror \
> --target=arm-eabi --enable-languages=c,d \
> --without-isl --without-cloog \
> --enable-multilib --disable-libphobos \
> --disable-libstdcxx  --disable-libssp --disable-libquadmath \
> --without-headers --with-newlib --with-system-zlib
>

You could also use the new binaries I uploaded to compiler explorer
for cross-checking whether the ICE is independently reproducible.

https://explore.dgnu.org/z/WKKMCg

I don't really expect any part of druntime to build on bare metal.
Too much depends on libc being available.

-- 
Iain



More information about the D.gnu mailing list