24 lines
695 B
Makefile
24 lines
695 B
Makefile
MCU = atmega328p
|
|
F_CPU = 16000000UL
|
|
CC = C:\Users\sharm\Desktop\Embedded Programming\avrprojects\avr8-gnu-toolchain-win32_x86_64\bin\avr-gcc
|
|
OBJCOPY = C:\Users\sharm\Desktop\Embedded Programming\avrprojects\avr8-gnu-toolchain-win32_x86_64\bin\avr-objcopy
|
|
AVRDUDE = ../avrdude
|
|
AVRDUDE_PROGRAMMER = arduino
|
|
AVRDUDE_PORT = COM8
|
|
AVRDUDE_BAUD = 115200
|
|
|
|
CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -Os -Wall
|
|
|
|
all: main.hex
|
|
|
|
main.elf: main.c
|
|
$(CC) $(CFLAGS) main.c -o main.elf
|
|
|
|
main.hex: main.elf
|
|
$(OBJCOPY) -O ihex -R .eeprom main.elf main.hex
|
|
|
|
upload: main.hex
|
|
$(AVRDUDE) -c $(AVRDUDE_PROGRAMMER) -p $(MCU) -P $(AVRDUDE_PORT) -b $(AVRDUDE_BAUD) -D -U flash:w:main.hex:i
|
|
|
|
clean:
|
|
rm -f main.elf main.hex
|