ARM Cortex-M Microcontroller startup files

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 27 10:17:18 PDT 2015


Am Mon, 27 Apr 2015 07:56:02 +0200
schrieb Iain Buclaw via Digitalmars-d <digitalmars-d at puremagic.com>:

> On 26 April 2015 at 22:41, Jens Bauer via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
> > On Sunday, 26 April 2015 at 18:23:47 UTC, Martin Nowak wrote:
> >>
> >> On 04/26/2015 07:29 PM, Jens Bauer wrote:
> >>>
> >>> Unfortunately, I have not been able to build with multilib yet,
> >>> so my setup cannot build code for Cortex-M0; it keeps stuffing
> >>> Cortex-M3 and Cortex-M4 instructions in there.
> >>
> >>
> >> The wiki says to disable multilib
> >>
> >> (http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler#Build_GCC),
> >> what's the problem?
> >
> >
> > The problem is that I cannot have a single compiler, which compiles
> > for these architectures:
> > ARM7TDMI
> > Cortex-M0
> > Cortex-M3
> > Cortex-M4
> >
> > Using a Cortex-M3 or Cortex-M4 compiler to build code for a
> > Cortex-M0, will insert 32-bit instructions randomly (most code is
> > 16-bit, though, so parts of it gets it right). As soon as the
> > microcontroller tries to run a 32-bit instruction, it will crash.
> >
> > -In order to build code for Cortex-M0 or Cortex-M0+, I will have to
> > rebuild the compiler.
> > The alternative is to build 5 different compilers. I don't want
> > that either.
> >
> > ...
> >
> > The reason I cannot build GDC with multilib, is that I get a
> > compile-error when building the final GCC+GDC.
> > Building GCC alone without GDC gives me no such error.
> > -So if I want to have multilib support, I will have to be without
> > GDC.
> 
> Where exactly does it error?
> 
> I can't think of a sole reason why gdc/libphobos would throw an error
> in multilib builds, so it must be something collateral (libstdc++) ?
> 
> Regards
> Iain.

It might be libbacktrace related. I saw errors building AVR32 multilibs
caused by libbacktrace: We pull in libbacktrace even if druntime/phobos
are disabled with --disable-libphobos.


Possible fix: gcc/d/config-lang.in

 compilers="cc1d\$(exeext)"
 
-target_libs="target-libphobos target-zlib target-libbacktrace"
+if eval test x\${enable_libphobos} "=" xno ; then
+    target_libs=""
+else
+    target_libs="target-libphobos target-zlib target-libbacktrace"
+fi
 
 # The D frontend is written in C++, so we need to build the C++
 # compiler during stage 1.


More information about the Digitalmars-d mailing list