avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] arv-gcc tools with assembler source code


From: Joerg Wunsch
Subject: Re: [avr-chat] arv-gcc tools with assembler source code
Date: Tue, 4 Aug 2009 07:36:44 +0200 (MET DST)

"Weddington, Eric" <address@hidden> wrote:

> However, to add to my previous post: The reason why you are getting
> the error above, is because you are not providing a main()
> function in your application. You need to define this function if
> you are going to use the toolchain.

More specifically: if you want to have avr-gcc link your entire job
(rather than linking it manually yourself), you have to name your
starting function main(), just like any C program does.

This is due to the code in crtXXX.o calling exactly that function as
the entry point of the actual program, after running all the usual
startup code.  Also, should main() ever return, the value returned
will then be passed to a function named exit(), which is not expected
to ever return itself.  Thus, you should also provide a symbol named
"exit".  If you're sure your main() never returns, it's fine to simply
define that symbol on the linker command-line, like

-Wl,--defsym,exit=0

The advantage of using avr-gcc to link the entire job is that that
startup code will still arrange the interrupt vector table on your
behalf, and initialize the stack pointer before calling main().  If
you don't care about these things, then better link your job manually
using avr-ld directly, rather than having avr-gcc call the linker.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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