Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
rob_connolly
PostPosted: May 27, 2007 - 06:23 AM
Newbie


Joined: May 27, 2007
Posts: 8


Hi, I'm assembling a program with avr-gcc and I get the following message:

Code:
/usr/lib/gcc/avr/4.1.0/../../../../avr/lib/avr4/crtm8.o: In function `__bad_interrupt':
../../../../crt1/gcrt1.S:123: undefined reference to `main'


The command i'm using to assemble is:

Code:
avr-gcc -gstabs -mmcu=atmega8 -I/usr/avr/include/ mycode.S -o mycode.elf


I don't think it's anything to do with my code, it seems to be something to do with an external file (one that i've never even heard of or included!)

As you can probably tell i'm quite new to this! If anyone could help i'd be really greatful.

Oh, it's on ubuntu feisty (using only packages from the ubuntu repos) if that's any help.

Thanks in advance

Rob
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: May 27, 2007 - 01:42 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 71188
Location: (using avr-gcc in) Finchingfield, Essex, England

Any C or asm program must provide a 'main' - you aren't. If this is an Asm project then label the entry to your code:
Code:
main:

and if there's C involved and you want entry to be into the C first then provide:
Code:
int main(void) {}

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
rob_connolly
PostPosted: May 27, 2007 - 10:41 PM
Newbie


Joined: May 27, 2007
Posts: 8


Hi,

I do have a main label:

Code:
#cseg
.org 0x0

rjmp main

.org 0x0400
main: ...


is that right? the code compiles with avra - but i need gcc's debuging support.
 
 View user's profile Send private message  
Reply with quote Back to top
rob_connolly
PostPosted: May 31, 2007 - 12:39 PM
Newbie


Joined: May 27, 2007
Posts: 8


ah - got it!

needed:

Code:
.global main


d'oh! you can tell i'm new to this assembly stuff!
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits