Changing microcontroller to correct one (ATmega328p).

Changing frequency to 16 MHz.
Adding make target "flash" for flashing produced .hex file.
This commit is contained in:
Marco Groß 2021-12-05 00:22:18 +01:00
parent a78e007886
commit 35e57060c6

View File

@ -3,8 +3,8 @@ BUILDFOLDER = ./build/
TARGET = $(BUILDFOLDER)$(TARGETNAME) TARGET = $(BUILDFOLDER)$(TARGETNAME)
INC = -Isrc/include -I/usr/lib/avr/include/ INC = -Isrc/include -I/usr/lib/avr/include/
CFLAGS = -Wall -Wpedantic -Wextra -g -Os -mmcu=atmega32u4 CFLAGS = -Wall -Wpedantic -Wextra -g -Os -mmcu=atmega328p
CPPFLAGS = -DF_CPU=8000000UL CPPFLAGS = -DF_CPU=16000000UL
SRC = $(wildcard src/*.c) SRC = $(wildcard src/*.c)
@ -14,6 +14,10 @@ $(TARGET): $(SRC)
mkdir -p build mkdir -p build
avr-gcc -o $@.elf $^ $(CPPFLAGS) $(CFLAGS) $(INC) avr-gcc -o $@.elf $^ $(CPPFLAGS) $(CFLAGS) $(INC)
avr-objcopy -j .text -j .data -O ihex $@.elf $@.hex 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: clean:
rm -fr ./src/*.o ./build/ rm -fr ./src/*.o ./build/