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
milesy
PostPosted: Mar 23, 2012 - 01:27 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


HI Guys

this is probably going to sound like a dumb question but i am having trouble gettin AVR studio 4 to compile a C programme

Essentially i am getting a cannot find ELF file error - can anyone help pint me in the right direction here (totaly new into this)

thanks
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 23, 2012 - 01:50 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


ok so in another thread i found to disable use Toolchain and point to WIN AVR make and gcc file.

I am now getting a gcc instalation problemm cant excute ccl - no such file or directory.

again any ideas?
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 23, 2012 - 02:04 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


ok (talking to myself here) i have the gcc linked to the wrong gcc......so now it seems to be doing something but i am getting code errors - can anyone link to a really simple flash led in C for the AT90s8515??
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 23, 2012 - 08:11 AM
10k+ Postman


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

I checked the datasheet. This should work:
Code:

#undef F_CPU
#define F_CPU 1000000UL // change to your CPU frequency
#include <avr/io.h>
#include <util/delay.h>

int main(void) {
   DDRC = 0xFF;
   while(1) {
     PORTC ^= 0xFF;
     _delay_ms(250);
   }
}

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 23, 2012 - 09:59 PM
Wannabe


Joined: Sep 11, 2008
Posts: 91


thanks clawson but i get this error with your suggestion above

rm -rf ledflashnet.o ledflashnet.elf dep/* ledflashnet.hex ledflashnet.eep ledflashnet.lss ledflashnet.map
Build succeeded with 0 Warnings...
avr-gcc -mmcu=at90s8515 -Wall -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT ledflashnet.o -MF dep/ledflashnet.o.d -c ../ledflashnet.c
../ledflashnet.c:4:24: util/delay.h: No such file or directory
../ledflashnet.c: In function `main':
../ledflashnet.c:10: warning: implicit declaration of function `_delay_ms'
make: *** [ledflashnet.o] Error 1
Build failed with 1 errors and 1 warnings...



if i can get a some sample code that works, i will be able to work from there
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 23, 2012 - 10:45 PM
Wannabe


Joined: Sep 11, 2008
Posts: 91


ok i think my problem here is

../ledflashnet.c:3:24: util/delay.h: No such file or directory


help??
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 23, 2012 - 11:05 PM
Wannabe


Joined: Sep 11, 2008
Posts: 91


lol ok found delay.h.....clawson your code was pointing to a different directory - ok so fixed that......compile works 100% however build now gives me

: undefined reference to `_delay_ms'
make: *** [ledflashnet.elf] Error 1
Build failed with 1 errors and 0 warnings...


again help?
 
 View user's profile Send private message  
Reply with quote Back to top
ezharkov
PostPosted: Mar 24, 2012 - 12:18 AM
Resident


Joined: Jun 21, 2005
Posts: 946
Location: Chicago area, USA

What version of avr-gcc and where did you get it from? Is it WinAVR?
You say "found delay.h" - where did you find it? Normally there should be no need to look for it. It should get installed with avg-gcc and the compiler should "find" it automatically.

If avr-gcc is installed correctly, the following should work:
Code:
avr-gcc -o led.elf -Os -mmcu=at90s8515 led.c
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 24, 2012 - 01:23 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


yes im using winavr

the code called for delay.h using

#include <util/delay.h>

but i found delay.h in the directory

c:\winavr\include

i then copied it to

c:\winave\avr\include/avr

and changed the code to read

#include <avr/delay.h>

when i do this it all compiles ok but complains about

: undefined reference to `_delay_ms'
make: *** [ledflashnet.elf] Error 1
Build failed with 1 errors and 0 warnings..
 
 View user's profile Send private message  
Reply with quote Back to top
ezharkov
PostPosted: Mar 24, 2012 - 03:21 AM
Resident


Joined: Jun 21, 2005
Posts: 946
Location: Chicago area, USA

milesy wrote:
yes im using winavr
What version?
Quote:
but i found delay.h in the directory

c:\winavr\include
I have WinAVR-20100110 and I do not see any "include". Again, it would help if you told us what WinAVR version and where did you get it from.

Quote:
i then copied it to

c:\winave\avr\include/avr
I assume that winave is a typo. Otherwise do not do that. Do not touch anything in the winavr directory.

If you want to use WinAVR, and you are just starting with avr-gcc, then just download the latest version, which is still 20100110 I believe, install it from scratch, and do not change anything in the winavr directory, do not copy anything, do not add anything, etc.
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 24, 2012 - 04:09 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


ok ill uninstall redownload and reinstall both avr studio and winavr.....

currently running version 20040404
 
 View user's profile Send private message  
Reply with quote Back to top
milesy
PostPosted: Mar 24, 2012 - 04:20 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


ok now i feel stupid.....resintalled as above an everything now works.....thanks for getting me going
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: Mar 24, 2012 - 08:14 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 22227
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
20040404
Why such a VERY OLD version??

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
milesy
PostPosted: Mar 24, 2012 - 09:26 AM
Wannabe


Joined: Sep 11, 2008
Posts: 91


oh because i first installed avr studio 5 and found i couldnt use the AT90 processor..installed V4 and then started with the errors as listed earlier and read somewhere that the early version of winavr worked better with avr 4.......turns out for me didnt matter but thats why
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 24, 2012 - 12:15 PM
10k+ Postman


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

2004 is not going to work with the latest Studio. You need a WinAVR from 2006 onwards and obviously the latest (2010) version would be the one to choose.

_________________
 
 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