20 lines
797 B
Plaintext
20 lines
797 B
Plaintext
Using makefile: (Path_2)
|
|
|
|
//remember to copy the the program into main.c file before execution
|
|
avr-gcc -Wall -Os -DF_CPU=16000000 -mmcu=atmega2560 -c main.c -o main.o
|
|
avr-gcc -Wall -Os -DF_CPU=16000000 -mmcu=atmega2560 -o main.elf main.o
|
|
rm -f main.hex
|
|
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
|
|
avrdude -c wiring -P /dev/ttyACM0 -p atmega2560 -U flash:w:main.hex:i
|
|
|
|
|
|
earlier method: (Path_1)
|
|
avr-gcc -Os -mmcu=atmega2560 -c -o blinking_led blinking_led.c //here -c flag is being used, leading to incorrect hex file
|
|
avr-objcopy -O ihex -R .eeprom blinking_led blinking_led.hex
|
|
avrdude -C /usr/share/arduino/hardware/tools/avrdude.conf -patmega2560 -cwiring -P /dev/ttyACM0 -b 115200 -D -U flash:w:blinking_led.hex:i
|
|
|
|
using makefile and makeflash: (Path_3)
|
|
make all
|
|
make flash
|
|
|