2021-12-02 20:57:19 +00:00
|
|
|
TARGETNAME = togglePin
|
|
|
|
BUILDFOLDER = ./build/
|
|
|
|
TARGET = $(BUILDFOLDER)$(TARGETNAME)
|
|
|
|
|
2022-05-11 18:38:02 +00:00
|
|
|
INC = -Isrc/include -I/usr/avr/include
|
|
|
|
CFLAGS = -Wall -Wpedantic -Wextra -Os -mmcu=atmega32u4
|
|
|
|
CPPFLAGS = -DF_CPU=8000000UL
|
2021-12-02 20:57:19 +00:00
|
|
|
|
|
|
|
SRC = $(wildcard src/*.c)
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(SRC)
|
|
|
|
mkdir -p build
|
2021-12-02 21:27:10 +00:00
|
|
|
avr-gcc -o $@.elf $^ $(CPPFLAGS) $(CFLAGS) $(INC)
|
2021-12-02 20:57:19 +00:00
|
|
|
avr-objcopy -j .text -j .data -O ihex $@.elf $@.hex
|
2021-12-04 23:22:18 +00:00
|
|
|
rm $@.elf
|
|
|
|
|
|
|
|
flash:
|
2022-05-11 20:21:00 +00:00
|
|
|
avrdude -p m32u4 -P /dev/ttyACM0 -c stk500v2 -Uflash:w:"$(TARGET).hex":i
|
2021-12-02 20:57:19 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -fr ./src/*.o ./build/
|