Error when Building Studio 4 and WinAVR? - Help!

Go To Last Post
22 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

New Studio 4 with WinAVR. Latest versions.

Simple test program will compile, but can't do a build all? Errors on *.elf ?

Have tried several new projects from scratch. Get the same results?

Is something set wrong? I don't know enough to fix this, especially don't want to make my own "make" file.

Thanks for any help!
Mike
I get one error, the description is below on Blinky.
Happens no matter what project I start, new or old?

avr-objcopy: 'Blinky.elf': No such file

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

4.19 does not find WinAVR so you must now set the location manually for each project under "Custom Options"

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

Thanks!
I un-checked AVR Tool Chain and tried a few times.

I see the option, but don't know what file to browse to? I want basic C. I tried a few and got error message that I had no compiler chosen?

Almost there? Don't know what file does the compiling?

Mike

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

Build failed... No build tools defined.

I have not picked the correct file yet?

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

Hit the "...config. options" button and go to "custom options" . Uncheck avr tools and in avr-gcc field you need to put the path to this, or wherever Winavr is on your PC :

C:\WinAVR-20100110\bin\avr-gcc.exe

In make field do :

C:\WinAVR-20100110\utils\bin\make.exe

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

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

OK!
Thanks! I wondered where the make file was!

Now I can continue!

Mike :D

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

I am getting the following error while building the code "undefined reference to main"
pls help me

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

Quote:

I am getting the following error while building the code "undefined reference to main"

None of the .o files being linked contains a function called main(). All C programs must have this.

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

sr i am trying to compile a simple program of lcd interfacing using Avr studio 4 and winavr.......bt sr at the time of building it it shows an error that "AVR Simulator: Invalid opcode 0xffff at address 0x001c00
"sr what should i do now........plz help me

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

Quote:

at the time of building

How can you get an error about the simulator when you are building?

Anyway, flash that has not been filled with code usually holds 0xFFFF so if you end up executing 0xFFFF it means something went seriously wrong in your program and the PC ended up with a rubbish value. Just one of an infinite number of ways for this to happen might be something like:

void a_function(void) {
  char buffer[10];
  int i;
  for (i = 0; i < 20; i++) {
    buffer[i] = PINB;
  }
}

That defines a 10 byte buffer on the stack but then writes to 20 locations. The ones "off the end" of the buffer are where the return address from which this function was called will be held so when this function does a RET it will go back to some completely random location.

As I say this is just one of an infinite number of ways to end up with PC holding an invalid value. You own the code, you have more idea why your own program is doing this than we do.

As your error clearly is not when building your thread hijack is completely off-topic for this question. I suggest you create a brand new thread in AVr Forum and post the code you are using because without it no one but you has any hope of seeing what it is you have done wrong.

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

sr my code is........

#include
#include

#define LCD_DATA PORTA // LCD data port
#define ctrl PORTB
#define en PB2 // enable signal
#define rw PB1 // read/write signal
#define rs PB0 // register select signal

void LCD_cmd(unsigned char cmd);
void init_LCD(void);
void LCD_write(unsigned char data);

int main()
{
DDRA=0xff; // making LCD_DATA port as output port
DDRB=0x07; // making signal as out put
init_LCD(); // initialization of LCD
_delay_ms(50); // delay of 50 milli seconds
LCD_write('A'); // call a function to write A on LCD
return 0;
}

void init_LCD(void)
{
LCD_cmd(0x38); // initialization of 16X2 LCD in 8bit mode
_delay_ms(1);

LCD_cmd(0x01); // clear LCD
_delay_ms(1);

LCD_cmd(0x0E); // cursor ON
_delay_ms(1);

LCD_cmd(0x80); // ---8 go to first line and --0 is for 0th position
delay_ms(1);
return;
}

void LCD_cmd(unsigned char cmd)
{
LCD_DATA=cmd;
ctrl =(0<<rs)|(0<<rw)|(1<<en); // RS and RW as LOW and EN as HIGH
_delay_ms(1);
ctrl =(0<<rs)|(0<<rw)|(0<<en); // RS, RW , LOW and EN as LOW
_delay_ms(50);
return;
}

void LCD_write(unsigned char data)
{
LCD_DATA= data;
ctrl = (1<<rs)|(0<<rw)|(1<<en); // RW as LOW and RS, EN as HIGH
_delay_ms(1);
ctrl = (1<<rs)|(0<<rw)|(0<<en); // EN and RW as LOW and RS HIGH
_delay_ms(50); // delay to get things executed
return ;
}

and my errors are.........

rm -rf bbb.o bbb.elf dep/* bbb.hex bbb.eep bbb.lss bbb.map
Build succeeded with 0 Warnings...
avr-gcc -mmcu=atmega16 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT bbb.o -MF dep/bbb.o.d -c ../bbb.c
In file included from ../bbb.c:2:
c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:85:3: warning: #warning "F_CPU not defined for "
avr-gcc -mmcu=atmega16 -Wl,-Map=bbb.map bbb.o -o bbb.elf
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature bbb.elf bbb.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex bbb.elf bbb.eep || exit 0
avr-objdump -h -S bbb.elf > bbb.lss
Build succeeded with 1 Warnings...

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

sr i have to know about this following error........

c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:85:3: warning: #warning "F_CPU not defined for "
plz help me sr

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

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Quote:
sr what should i do now........plz..bt sr
Start using proper English rather than SMS talk and people may take you a bit more seriously.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Sr what should i do to remove this error........

c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:85:3: warning: #warning "F_CPU not defined for "
.......

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

Quote:

Sr what should i do to remove this error........


Repeat..

Read this: http://www.nongnu.org/avr-libc/u...

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

sr still is a problem........bt its only a warning...and when i double click at it....a yellow colour's arrow points to my programs particular line that is "DDRA=0xff".....and the warning is

AVR Simulator: Invalid opcode 0xffff at address 0x001c00

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

Dear sir my Code is.......
#define F_CPU 1000000UL
#include
#include
int main(void) {
DDRC = 0xFF;
DDRD = 0xFF;
PORTC = 0x00;
PORTD = 0x00;

while(1) {
PORTD = 0x80;
_delay_ms(125);
PORTD = 0x00;
_delay_ms(125);
PORTC=0x01;
_delay_ms(125);
PORTC = 0x00;
_delay_ms(125);
PORTC=0x02;
_delay_ms(125);
PORTC = 0x00;
_delay_ms(125);
PORTC=0x04;
_delay_ms(125);
PORTC = 0x00;
_delay_ms(125);
}
}
But sir as i build it.....it gives me a warning...
c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:90:3: warning: #warning "Compiler optimizations disabled; functions from won't work as designed"
that is the reason it is not detecting my header file.
i also included exact path for external compiler)(Winavr)...

C:\WinAVR-20100110\bin\avr-gcc.exe

C:\WinAVR-20100110\utils\bin\make.exe

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

Quote:

that is the reason it is not detecting my header file.

Err no it is clearly detecting util/delay.h as that warning is coming from inside the file. Why not actually read the words it says? It is telling you exactly what is wrong.

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

What is interesting is that you were knowledgeable enough to change the optimization setting in the first place but not knowledgeable enough to read the warning and revert the optimization setting back to default :roll:

Alex

"For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter."
Author Unknown

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

#include
#include
void main()
{
unsigned int adc_value; DDRB|=(1<<PB0)|(1<<PB1);
DDRB&=~(1<<PB3);
void adc_init()
{
ADCSRA=0xe3;
ADMUX=0xe1;
}

adc_init();
While(1)
{
while (ADCSRA&(1<<ADIF));
adc_value = ADCH;
if (adc_value < 512)
{
portB|=(1<<PB0);
port B&=~(1<<PB1);
_delay_ms(7000);
}
else
{
PORTB&=~(1<<PB0);
PORTB|=(1<<PB1);
}
}
}
Sir, i recently downloaded avr studio 4.19 and have the latest winavr. I have already changed the pathways to winavr/bin/avr-gcc and winavr/utils/bin/make.
My code for a simple adc conversion using attiny 13a and the code is given above. The error i get while building is unrecognised command line option "mmcuattiny13a"

PS: im a newbie

Soumyajit

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

Although it's 6 years old the C compiler in WinAVR does know the tiny13a:

Known MCU names:
  avr1 avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1
  avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 at90s1200
  attiny11 attiny12 attiny15 attiny28 at90s2313 at90s2323 at90s2333
  at90s2343 attiny22 attiny26 at90s4414 at90s4433 at90s4434 at90s8515
  at90c8534 at90s8535 ata6289 attiny13 attiny13a attiny2313 attiny2313a
  attiny24 attiny24a attiny4313 attiny44 attiny44a attiny84 attiny25
  attiny45 attiny85 attiny261 attiny261a attiny461 attiny461a attiny861
  attiny861a attiny87 attiny43u attiny48 attiny88 at86rf401 at43usb355
  at76c711 atmega103 at43usb320 attiny167 at90usb82 at90usb162 atmega8u2
  atmega16u2 atmega32u2 atmega8 atmega48 atmega48a atmega48p atmega88
  atmega88a atmega88p atmega88pa atmega8515 atmega8535 atmega8hva
  atmega4hvd atmega8hvd at90pwm1 at90pwm2 at90pwm2b at90pwm3 at90pwm3b
  at90pwm81 atmega16 atmega16a atmega161 atmega162 atmega163 atmega164a
  atmega164p atmega165 atmega165a atmega165p atmega168 atmega168a
  atmega168p atmega169 atmega169a atmega169p atmega169pa atmega16hva
  atmega16hvb atmega32 atmega323 atmega324a atmega324p atmega324pa
  atmega325 atmega325p atmega3250 atmega3250p atmega328 atmega328p
  atmega329 atmega329p atmega329pa atmega3290 atmega3290p atmega32hvb
  atmega406 atmega64 atmega640 atmega644 atmega644a atmega644p atmega644pa
  atmega645 atmega645a atmega645p atmega649 atmega649a atmega649p
  atmega6450 atmega6450a atmega6450p atmega6490 atmega6490a atmega6490p
  atmega64hve atmega16hva atmega16hva2 at90can32 at90can64 at90pwm216
  at90pwm316 atmega16m1 atmega16u4 atmega32c1 atmega32m1 atmega32u4
  atmega32u6 atmega64c1 atmega64m1 at90usb646 at90usb647 at90scr100 at94k
  atmega128 atmega1280 atmega1281 atmega1284p atmega128rfa1 at90can128
  at90usb1286 at90usb1287 m3000f m3000s m3001b atmega2560 atmega2561
  atxmega16a4 atxmega16d4 atxmega32d4 atxmega32a4 atxmega64a3 atxmega64d3
  atxmega64a1 atxmega128a3 atxmega128d3 atxmega192a3 atxmega192d3
  atxmega256a3 atxmega256a3b atxmega256d3 atxmega128a1

So passing -mmcu=attiny13a should work. However your error message is "unrecognised command line option "mmcuattiny13a"" which suggests that a '-' at the start and a '=' in the middle are missing.

 

But seriously, why not upgrade to avr-gcc 4.8.1 or even 4.9.2? Atmel have builds of both for Windows.