Cross compiler for embedded microcontrollers ?

Mike via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 16 06:55:30 PST 2015


On Friday, 16 January 2015 at 10:04:55 UTC, Jens Bauer wrote:
> Build failed on final gcc.
>
> I normally use newlib and multilib, because I'm developing for 
> Cortex-M0, Cortex-M3 and Cortex-M4 and would like to be able to 
> switch between those and use the same compiler.
> But following the above mentioned instructions seem to suggest 
> disabling multilib and using libgcc instead of newlib. Has 
> anyone used newlib with a Cortex-M based GDC toolchain ?

I wrote the those instructions on the wiki, but I don't have 
experience building a multilib toolchain, or building one with 
newlib.  I recommend going to 
https://launchpad.net/gcc-arm-embedded and downloading the source 
code package.  After extracting the archive, you'll find a three 
bash scripts that do the build.  It's an extremely complicated 
script, but inside you can find all the necessary commands for 
multilib and newlib builds.  That's the resource I used to figure 
it out and write those instructions.

My goal is to use D without having to rely on a C standard 
library, and I've demonstrated that it is feasible and even 
desirable.  Therefore, the instructions on the wiki don't include 
a C library like newlib.  I don't think D needs to leverage the C 
standard library, and as you're finding out, more dependencies = 
more problems.  I view libgcc as part of the toolchain itself, so 
I will be leveraging that in the future.

If you want to use the the C library, though, check out minlibd: 
https://bitbucket.org/timosi/minlibd.  That project has some 
documentation for building a toolchain:  
https://bitbucket.org/timosi/minlibd/wiki/gdc_cross_compiler

The other option would be to use crosstools-ng:  
http://crosstool-ng.org/.  But, I had a hell of time with that 
last time I tried:  
http://forum.dlang.org/post/ptedovhanscsgshlemlb@forum.dlang.org

Mike


More information about the Digitalmars-d mailing list