aaio

AVR All-In-One helper C library for Arduino boards
git clone git://git.luxferre.top/aaio.git
Log | Files | Refs

Makefile (749B)


      1 PROGRAM_NAME = example_blonk
      2 BUILD_DIR = build
      3 MCU = atmega2560
      4 MCUSHORT = m2560
      5 MCUDEFS = -DF_CPU=16000000UL -DAAIO_MEGA2560
      6 PROG_PARAMS = -c wiring -P /dev/ttyUSB0
      7 
      8 #MCU = atmega328p
      9 #MCUSHORT = m328p
     10 #MCUDEFS = -DF_CPU=8000000UL -DAAIO_NANO
     11 #PROG_PARAMS = -c wiring -P /dev/ttyUSB0
     12 
     13 SUDOCMD = doas
     14 
     15 all: $(PROGRAM_NAME)
     16 
     17 $(BUILD_DIR):
     18 	mkdir -pv $(BUILD_DIR)
     19 
     20 $(PROGRAM_NAME): $(BUILD_DIR)
     21 	avr-gcc -mmcu=$(MCU) $(MCUDEFS) -Wall -Os -o $(BUILD_DIR)/$(PROGRAM_NAME).elf $(PROGRAM_NAME).c
     22 	avr-objcopy -j .text -j .data -O ihex $(BUILD_DIR)/$(PROGRAM_NAME).elf $(BUILD_DIR)/$(PROGRAM_NAME).hex
     23 
     24 upload: $(PROGRAM_NAME)
     25 	$(SUDOCMD) avrdude -p $(MCUSHORT) $(PROG_PARAMS) -D -U flash:w:$(BUILD_DIR)/$(PROGRAM_NAME).hex:i
     26 
     27 clean:
     28 	rm -rf $(BUILD_DIR)