AVR Studio 4 GCC

Last post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I checked the datasheet. This should work:

#undef F_CPU
#define F_CPU 1000000UL // change to your CPU frequency
#include 
#include 

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

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok i think my problem here is

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

help??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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:

avr-gcc -o led.elf -Os -mmcu=at90s8515 led.c
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes im using winavr

the code called for delay.h using

#include

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

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..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

currently running version 20040404

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok now i feel stupid.....resintalled as above an everything now works.....thanks for getting me going

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
20040404
Why such a VERY OLD version??

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.