[Top][All Lists]

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

Re: [avr-gcc-list] How to skip c-runtime init

From: Dave Hylands
Subject: Re: [avr-gcc-list] How to skip c-runtime init
Date: Wed, 18 May 2005 16:25:47 -0700

If you run avr-gcc with the -v option you can see exactly what it
passes down to avr-ld.

For example:


   avr-gcc -v -mmcu=atmega128 -o hello.elf hello.o

you'll see that -lc and -lgcc are passed into avr-ld. If you use:

   avr-gcc -v -mmcu=atmega128 -o hello.elf -nostdlib hello.o

you'll see that these two libraries are NOT passed down to avr-ld.

You'll also notice that if you compile a file which contains a main
function, that the following symbols are referenced:

        U __do_clear_bss
        U __do_copy_data
0000003e a __SP_H__
0000003d a __SP_L__
0000003f a __SREG__
        U __stack
00000000 a __tmp_reg__
00000001 a __zero_reg__
        U exit
00000000 T main
        U printf

So you can see that it tries to call do_clear_bss, do_clear_data,
exit, and reference the stack. By changing the main to a different
function and telling the linker about it, you don't get the
"automagic" stuff generated.

Dave Hylands
Vancouver, BC, Canada

reply via email to

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