[Top][All Lists]

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

Re: [avr-gcc-list] Modifying compiler output to suit Tiny13 bootloader

From: Andrew Zabolotny
Subject: Re: [avr-gcc-list] Modifying compiler output to suit Tiny13 bootloader
Date: Mon, 26 Oct 2009 10:10:54 +0300

From Sun, 25 Oct 2009 18:45:36 -0400
David Carr <address@hidden> wrote:

> It looks like the rjmp at address 0 is generated by the file 
> /usr/avr/lib/crttnXX.o.  This file seems to be generated during the 
> avr-libc build process from a file called gcrt1.S in the avr-libc 
> distribution.  To override this behavior it seems that I'd have to
> make a custom start up assembly file and use it for my bootloader-C 
> projects.  That sounds messy.
If you run 'avr-gcc -dumpspecs' (or look at the 'specs' file directly)
you can see the logic that chooses startup file and linker options. At
the first look it may seem messy but in fact the syntax is simple:
every expression in curly braces is a "if", the condition
(gcc command-line option) is before a double colon and the replacement
text is after double colon. For example, "%{mmcu=attiny12:crttn12.o%s}"
means that if the "-mmcu-attiny12" option is specified at gcc command
line, the crt_binutils spec will get a "crttn12.o" in it. As a special
exception, if there's nothing after double colon, the option is copied
as-is to output spec (e.g. "%{static:}").

Now the expressions in round braces are recursive invocations of
another spec. For example, the link_command spec invokes the
%(link_libgcc) spec and so on. You can find more about specs files in
gcc manual.

Now if you understand the specs well, you can write your own .spec
file. Then you just specify your spec file during link using the
"-specs=" option. This way you can override anything anywhere.


Attachment: signature.asc
Description: PGP signature

reply via email to

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