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:
parent
a78e007886
commit
35e57060c6
8
Makefile
8
Makefile
@ -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/
|
||||||
|
Loading…
Reference in New Issue
Block a user