commit 5485b4fa2178e65a72246e6a59065a2ca12fe5b0 parent 2aeda1c29136a55618d2159661fe1a120326b099 Author: Luxferre <lux@ferre> Date: Sun, 17 Nov 2024 21:00:45 +0200 first upload Diffstat:
A | Makefile | | | 28 | ++++++++++++++++++++++++++++ |
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile @@ -0,0 +1,28 @@ +PROGRAM_NAME = example_blonk +BUILD_DIR = build +MCU = atmega2560 +MCUSHORT = m2560 +MCUDEFS = -DF_CPU=16000000UL -DAAIO_MEGA2560 +PROG_PARAMS = -c wiring -P /dev/ttyUSB0 + +#MCU = atmega328p +#MCUSHORT = m328p +#MCUDEFS = -DF_CPU=8000000UL -DAAIO_NANO +#PROG_PARAMS = -c wiring -P /dev/ttyUSB0 + +SUDOCMD = doas + +all: $(PROGRAM_NAME) + +$(BUILD_DIR): + mkdir -pv $(BUILD_DIR) + +$(PROGRAM_NAME): $(BUILD_DIR) + avr-gcc -mmcu=$(MCU) $(MCUDEFS) -Wall -Os -o $(BUILD_DIR)/$(PROGRAM_NAME).elf $(PROGRAM_NAME).c + avr-objcopy -j .text -j .data -O ihex $(BUILD_DIR)/$(PROGRAM_NAME).elf $(BUILD_DIR)/$(PROGRAM_NAME).hex + +upload: $(PROGRAM_NAME) + $(SUDOCMD) avrdude -p $(MCUSHORT) $(PROG_PARAMS) -D -U flash:w:$(BUILD_DIR)/$(PROGRAM_NAME).hex:i + +clean: + rm -rf $(BUILD_DIR)