I'm trying to flash pure c-code to arduino Mega2560 board from linux using avr-gcc & avrdude. Compilation is done , now trying to flash using avr-dude, getting error as "avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00"
I used below command to produce hex file
avr-gcc -mmcu=atmega2560 -DF_CPU=16000000UL led.c -o led.elf
In file included from led.c:3:0: /usr/lib/avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from won't work as designed" [-Wcpp] # warning "Compiler optimizations disabled; functions from won't work as designed"
And then
avr-objcopy -j .text -O ihex led.elf led.hex
finally for flashing
avrdude -F -V -c arduino -p ATMEGA2560 -P /dev/ttyACM3 -b 115200 -U flash:w:led.hex
FYI: port is correct & RX pin is blinking i.e connection is perfect between computer & board
-DF_CPU=1000000UL
is 1MHz. I'm pretty sure Arduino Mega2560 runs on 16MHz. Anyway, you can try to use PlatformIO CLI (I'm using it on Linux machine and it works fine with several different Arduinos)avrdude
command withstty -F /dev/ttyACM3 hupcl &&