programming arduino duemilanove via avrdude

Hi!

I try to program scetch directly from comand line:

./avrdude -D -C ./avrdude.conf -p m328p -b 57600 -c stk500v1 -U "flash:w:sample.hex" -P /dev/ttyUSB0

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "sample.hex"
avrdude: input file sample.hex auto detected as Intel Hex
avrdude: writing flash (7328 bytes):

Writing | ################################################## | 100% 2.14s

avrdude: 7328 bytes of flash written
avrdude: verifying flash memory against sample.hex:
avrdude: load data flash data from input file sample.hex:
avrdude: input file sample.hex auto detected as Intel Hex
avrdude: input file sample.hex contains 7328 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.58s

avrdude: verifying ...
avrdude: 7328 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

after this i cant reprogram board using bootloader

reprograming bootloader using parallell programming cause board programing ok from IDE

where is mistake?

i read http://www.javiervalcarce.eu/wiki/Progr … th_AVR-GCC article.

if i replace avrdude command to look like:

./avrdude -D -C ./avrdude.conf -p m328p -b 57600 -c stk500v1 -U lfuse:w:0xff:m  -U hfuse:w:0xda:m -U efuse:w:0x05:m -U "flash:w:sample.hex" -P /dev/ttyUSB0

is it solve my problem?

solved)))

it was problem in linking and building hex file

with makefile like:

all: sample.hex

sample.o: sample.c
        avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L sample.c

sample.elf: sample.o
        avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -osample.elf sample.o -lm

sample.hex: sample.elf
        avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 sample.elf sample.eep
        avr-objcopy -O ihex -R .eeprom sample.elf sample.hex
        avr-size sample.hex

clean:
        rm -rf *.o *.hex *.elf *.asm *.eep

flash: sample.hex
        ./avrdude -C./avrdude.conf -q -q -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:sample.hex:i