GymPal/Makefile

27 lines
876 B
Makefile
Raw Normal View History

2022-12-02 10:42:42 +00:00
all: clean build
clean:
rm -rf bin/
# The following settings are very important!
# -c arduino for flashing to an AVR device with arduino bootloader.
# -p atmega328p is for the specific microcontroller.
# -b 57600 is the baudrate for transmission. Nano boards ONLY accept 57600, uno boards might accept 115200.
# -P specifies the port.
2022-12-02 10:42:42 +00:00
flash: build
avrdude -c arduino -p atmega328p -P /dev/ttyUSB0 -b 57600 -U flash:w:bin/gympal.hex:i
2022-12-02 10:42:42 +00:00
build: gympal.hex
gympal.hex: gympal.o control.o
avr-gcc -Os -mmcu=atmega328p -o bin/gympal.elf bin/gympal.o bin/control.o
2022-12-02 10:42:42 +00:00
avr-objcopy -O ihex -R .eeprom bin/gympal.elf bin/gympal.hex
gympal.o: src/gympal.c bin
avr-gcc -Wall -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o bin/gympal.o src/gympal.c
control.o: src/control.c bin
avr-gcc -Wall -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o bin/control.o src/control.c
2022-12-02 10:42:42 +00:00
bin:
mkdir bin