[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] why avr-gcc and not avr-ld
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] why avr-gcc and not avr-ld |
Date: |
Tue, 9 Oct 2001 18:27:56 +0200 (MET DST) |
Tim Lapawa <address@hidden> wrote:
> Wich options must I pass to avr-ld to behave like avr-gcc??
-v tells you more about it:
$ avr-gcc -v -O2 -Wall -mmcu=at90s2333 demo.c -o demo.out
Reading specs from /usr/local/lib/gcc-lib/avr/3.0/specs
Configured with: ./configure --target=avr --prefix=/usr/local i386--freebsd4.4
Thread model: single
gcc version 3.0
/usr/local/lib/gcc-lib/avr/3.0/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=0
-D__GNUC_PATCHLEVEL__=0 -DAVR -D__AVR__ -D__AVR -D__OPTIMIZE__
-D__STDC_HOSTED__=1 -Wall -D__AVR_ARCH__=2 -D__AVR_AT90S2333__
-D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__INT_MAX__=32767 demo.c
-quiet -dumpbase demo.c -mmcu=at90s2333 -O2 -Wall -version -o
/var/tmp/cc9oykMl.s
GNU CPP version 3.0 (cpplib) (GNU assembler syntax)
GNU C version 3.0 (avr)
compiled by GNU C version 2.95.3 20010315 (release) [FreeBSD].
ignoring nonexistent directory "/usr/local/avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc-lib/avr/3.0/include
/usr/local/avr/include
End of search list.
demo.c:378: warning: return type of `main' is not `int'
/usr/local/lib/gcc-lib/avr/3.0/../../../../avr/bin/as -mmcu=at90s2333 -o
/var/tmp/cccBRJOc.o /var/tmp/cc9oykMl.s
/usr/local/lib/gcc-lib/avr/3.0/../../../../avr/bin/ld -m avr23xx -o demo.out
/usr/local/lib/gcc-lib/avr/3.0/../../../../avr/lib/crts2333.o
-L/usr/local/lib/gcc-lib/avr/3.0
-L/usr/local/lib/gcc-lib/avr/3.0/../../../../avr/lib /var/tmp/cccBRJOc.o -lgcc
-lc -lgcc
The last (fairly long, sorry about that) line is the linker command
line. Depending on your actual MCU target, and configured path names,
it will differ.
It's usually always a good idea to use the compiler front-end instead
of using the linker directly. If you specify "-nostdlib" on the
command line, neither the crtXXX.o file nor any of the default
libraries will be linked. Unix C compiler front ends determine the
type of the input file based on the suffix, thus:
..c is considered C code
..cpp or .C is considered C++ code
..S is considered assembler code to be passed through the C preprocessor
..s is considered assembler code not to be preprocessed
anything else is considered linker input files (usually .o or .a
files). You can mix any of these file types on a single command line.
Due to this flexibility, there's usually no need to call any of the
lower-level tools (cpp, cc1, as, ld) directly. If you want to specify
a direct linker input option, you can do that with -Xlinker, like
avr-cc -Xlinker --cref -o demo.out demo.c
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/