gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] AVR cross-compiler libraries


From: Gaius Mulley
Subject: Re: [Gm2] AVR cross-compiler libraries
Date: Sat, 16 May 2015 23:15:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Will Rose <address@hidden> writes:

> Building an x86 => AVR cross-compiler from the current gm2/gcc-4.7.4
> sources is straightforward, but I'm a bit confused about the
> libraries. I've dug a posting by Gaius Mulley out of the archives, and
> it recommends compiling with:
>
> $ avr-gm2 -mmcu=atmega328 -g -Os -fno-exceptions -O2 -c
> flashled328.mod \ -flibs=min $ avr-gm2 -mmcu=atmega328 -g -Os
> -fno-exceptions -O2 -fno-pth - fonlylink \ flashled328.mod -flibs=min
> -o flashled328.elf
>
> This works, and produces a valid ATmega hex file. However, I don't
> understand the use of both Os and O2; are they both necessary? A
> one-step build:
>
> avr-gm2 -mmcu=atmega328 -Os -fno-execeptions -fno-pth -flibs=min \
> flashled328.mod -o flashled328.elf
>
> also seems to work. Is this a reasonable way to build binaries?

Hi Will,

yes this is reasonable.  The combination of -Os and -O2 probably does
not make sense.  -Os will optimize at level 2 and turns off
any optimization which results in larger code.

I used a two step build to separate the compile from the link.  But yes
they can be combined together.  Also you might find the recently
introduced -fm2-whole-program option useful.

> Finally, what libraries are used for eg: standard I/O? The avr-libc
> library compiles correctly; is it expected that its functions will be
> used via M2's C calling convention?

yes this is possible.  It would need a DEFINITION MODULE FOR "C" to be
written.  Maybe an equivalent C program to wrap up any pseudo functions
(which are really macros) into a real C functions.  Thereafter it should
all work fine

regards,
Gaius



>
> Thanks for any ideas - Will
>
>
> _______________________________________________
> gm2 mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/gm2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]