| Author |
Message |
|
|
Posted: Mar 23, 2012 - 01:27 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
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 |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 01:50 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
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? |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 02:04 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
| 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?? |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 08:11 AM |
|


Joined: Jul 18, 2005
Posts: 62292
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);
}
}
|
_________________
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 09:59 PM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
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 |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 10:45 PM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
ok i think my problem here is
../ledflashnet.c:3:24: util/delay.h: No such file or directory
help?? |
|
|
| |
|
|
|
|
|
Posted: Mar 23, 2012 - 11:05 PM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
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? |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 12:18 AM |
|

Joined: Jun 21, 2005
Posts: 882
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
|
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 01:23 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
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.. |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 03:21 AM |
|

Joined: Jun 21, 2005
Posts: 882
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. |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 04:09 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
ok ill uninstall redownload and reinstall both avr studio and winavr.....
currently running version 20040404 |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 04:20 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
| ok now i feel stupid.....resintalled as above an everything now works.....thanks for getting me going |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 08:14 AM |
|


Joined: Mar 28, 2001
Posts: 20363
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
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 09:26 AM |
|

Joined: Sep 11, 2008
Posts: 73
|
|
| 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 |
|
|
| |
|
|
|
|
|
Posted: Mar 24, 2012 - 12:15 PM |
|


Joined: Jul 18, 2005
Posts: 62292
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. |
_________________
|
| |
|
|
|
|
|