GymPal/Makefile

27 lines
876 B
Makefile

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.
flash: build
avrdude -c arduino -p atmega328p -P /dev/ttyUSB0 -b 57600 -U flash:w:bin/gympal.hex:i
build: gympal.hex
gympal.hex: gympal.o control.o
avr-gcc -Os -mmcu=atmega328p -o bin/gympal.elf bin/gympal.o bin/control.o
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
bin:
mkdir bin