inv-sw-32u4/Makefile
Marco Groß 35e57060c6 Changing microcontroller to correct one (ATmega328p).
Changing frequency to 16 MHz.
Adding make target "flash" for flashing produced .hex file.
2021-12-05 00:22:18 +01:00

24 lines
534 B
Makefile

TARGETNAME = togglePin
BUILDFOLDER = ./build/
TARGET = $(BUILDFOLDER)$(TARGETNAME)
INC = -Isrc/include -I/usr/lib/avr/include/
CFLAGS = -Wall -Wpedantic -Wextra -g -Os -mmcu=atmega328p
CPPFLAGS = -DF_CPU=16000000UL
SRC = $(wildcard src/*.c)
all: $(TARGET)
$(TARGET): $(SRC)
mkdir -p build
avr-gcc -o $@.elf $^ $(CPPFLAGS) $(CFLAGS) $(INC)
avr-objcopy -j .text -j .data -O ihex $@.elf $@.hex
rm $@.elf
flash:
avrdude -p m328p -P /dev/ttyUSB0 -c arduino -b 57600 -Uflash:w:"$(TARGET).hex":i
clean:
rm -fr ./src/*.o ./build/