Problems sending complied c code using avrdude.

Hi,

I have an Arduino Duemilanove with a ATMEGA328P-PU chip. I’ve writen a c code, now
I’m trying to send the compiled code to my arduino board using avrdude, but I’m facing some issues:

I’m using the folowing comand lines:

These lines to compile the code:

avr-gcc -DF_CPU=16000000L -mmcu=atmega328p -o test.out test.c 
avr-objcopy -O ihex -R .eeprom teste.out teste.hex

And this line to send to arduino:

avrdude -V -F -c stk500 -p m328p -b 57600 -P /dev/ttyUSB2 -U flash:w:o.hex

Here is my output

bash-3.1$ avr-gcc -DF_CPU=16000000L -mmcu=atmega328p -o test.out test.c 
In file included from test.c:2:
/home/ryu/Aplications/avr/lib/gcc/avr/4.3.4/../../../../avr/include/util/delay.h:90:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
bash-3.1$ avr-objcopy -O ihex -R .eeprom test.out test.hex
bash-3.1$ sudo avrdude -V -F -c stk500 -p m328p -b 57600 -P /dev/ttyUSB2 -U flash:w:test.hex
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
^C
bash-3.1$

I’m stil able to send programs trough the arduino-0017 IDE, I only have those errors when using avrdude manualy in the terminal.
Do you guys have any ideas to help me?

Thanks.

The board probably isn't auto-resetting (which happens via the DTR line). If you're on Linux, you can try setting HUPCL on the serial device using stty: stty -F /dev/ttyUSB2 hupcl

Thanks mellis, this worked out. ;D