inv-sw-32u4/Makefile

24 lines
550 B
Makefile
Raw Normal View History

2021-12-02 20:57:19 +00:00
TARGETNAME = togglePin
BUILDFOLDER = ./build/
TARGET = $(BUILDFOLDER)$(TARGETNAME)
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
avr-gcc -o $@.elf $^ $(CPPFLAGS) $(CFLAGS) $(INC) -Wl,-u,vfprintf -lprintf_flt -lm
2021-12-02 20:57:19 +00:00
avr-objcopy -j .text -j .data -O ihex $@.elf $@.hex
rm $@.elf
flash:
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/