On Mar 7, 2011, at 2:34 PM, Matt wrote:

> It compiles the C and assembles the assembler OK, but then fails to  
> link
> properly.
> I get:  ... undefined reference to `main'

Ah, if you have a pure assembler file that you're not planning on  
linking with C modules or main, you'll need to pass in C and link  
parameters to supressing adding the normal C startup files.
For an AVR bootloader, I end up using something like:

/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide- 
types -mshort-calls -mmcu=atmega168 -DF_CPU=16000000L  '- 
DBAUD_RATE=115200' -Wl,--section-start=.text=0x3F00 -Wl,--relax - 
nostdlib -nostartfiles -o foo.elf optiboot.S

Some of those are copied from previous peoples' make files, and I  
don't know exactly what they do.  The -nostdlib and -nostartfiles are  
the important bits WRT this conversation.  I think.

BillW


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to