Pages: [1]   Go Down
Author Topic: Using AVR Studio 4 to debug & run blinky.c  (Read 1481 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using AVR Studio 4, Dragon prog'r and my Uno_328P to load debug & run blinky.c

Code:
/* blinky.c source code */
 
#include <avr/io.h>
#include <util/delay.h>

#define BAUD_RATE 19200
UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
UCSR0B = (1<<RXEN0) | (1<<TXEN0);
UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
 
int main (void)
{
  unsigned char counter;
  /* set PORTB for output*/
  DDRB = 0xFF;
 
  while (1)
    {
      /* set PORTB.2 high */
      PORTB = 0xFF;
 
      /* wait (10 * 120000) cycles = wait 1200000 cycles */
      counter = 0;
      while (counter != 50)
{
  /* wait (30000 x 4) cycles = wait 120000 cycles */
  _delay_loop_2(30000);
  counter++;
}
 
      /* set PORTB.2 low */
      PORTB = 0x00;
 
      /* wait (10 * 120000) cycles = wait 1200000 cycles */
      counter = 0;
      while (counter != 50)
{
  /* wait (30000 x 4) cycles = wait 120000 cycles */
  _delay_loop_2(30000);
  counter++;
}
    }
 
  return 1;
}

I confirmed that the Uno is connected OK by reading back the device signature and Vtarget=3.6v in AVR Studio.
The device is erased and ready to program. When I try to Build the program it gives;
Code:
Build started 12.11.2011 at 20:45:09
mmcu=atmega328p -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT blinky01.o -MF dep/blinky01.o.d  -c  ../blinky01.c
/usr/bin/sh: -Wall: command not found
make: [blinky01.o] Error 127 (ignored)
mmcu=atmega328p -Wl,-Map=blinky01.map blinky01.o     -o blinky01.elf
/usr/bin/sh: -Wl,-Map=blinky01.map: command not found
make: [blinky01.elf] Error 127 (ignored)
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature  blinky01.elf blinky01.hex
avr-objcopy: 'blinky01.elf': No such file
make: *** [blinky01.hex] Error 1
Build failed with 1 errors and 0 warnings...
I don't understand the error it gives.
Suggestions are appreciated.
Thanks!
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 58
Posts: 1742
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem is that your code didn't compile.
It didn't compile because your make didn't provide a compile command. You can see this here:
Quote
mmcu=atmega328p -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT blinky01.o -MF dep/blinky01.o.d  -c  ../blinky01.c
/usr/bin/sh: -Wall: command not found
It should be something like
Quote
[The compiler I user] mmcu=atmega328p -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT blinky01.o -MF dep/blinky01.o.d  -c  ../blinky01.c
/usr/bin/sh: -Wall: command not found
I'm not sure why he is complaining about Wall and not mmcu as "command not found" but it is clear your compiler is missing

Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your reply. I needed to set the path to the WINAVR dir. It was missing in the /Project/Config. Options/Custom Options box.
The Use ext. AVR chain box needs to be unchecked as well.
Thanks!
Logged

Pages: [1]   Go Up
Jump to: