I'm using AVR Studio 4, Dragon prog'r and my Uno_328P to load debug & run blinky.c
/* 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;
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!