aaio

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

Makefile (1038B)


      1 PROGRAM_NAME = example_blonk
      2 BUILD_DIR = build
      3 SERIALDEV = /dev/ttyUSB0
      4 
      5 #MCU = atmega2560
      6 #MCUSHORT = m2560
      7 #MCUDEFS = -DF_CPU=16000000UL -DAAIO_MEGA2560
      8 #PROG_PARAMS = -c wiring -P $(SERIALDEV) -D
      9 
     10 #MCU = atmega328pb
     11 #MCUSHORT = m328pb
     12 #MCUDEFS = -DF_CPU=16000000UL -DAAIO_NANO
     13 #PROG_PARAMS = -c arduino -P $(SERIALDEV) -D
     14 
     15 MCU = atmega168pa
     16 MCUSHORT = m168pa
     17 MCUDEFS = -DF_CPU=16000000UL -DAAIO_NANO
     18 PROG_PARAMS = -c arduino -P $(SERIALDEV) -D
     19 
     20 #if you use urboot
     21 #PROG_PARAMS = -c urclock -P $(SERIALDEV) -D
     22 
     23 # if you use a hardware USB programmer
     24 #PROG_PARAMS = -c usbasp
     25 
     26 SUDOCMD = doas
     27 
     28 all: $(PROGRAM_NAME)
     29 
     30 $(BUILD_DIR):
     31 	mkdir -pv $(BUILD_DIR)
     32 
     33 $(PROGRAM_NAME): $(BUILD_DIR)
     34 	avr-gcc -mmcu=$(MCU) $(MCUDEFS) -Wall -Os -o $(BUILD_DIR)/$(PROGRAM_NAME).elf $(PROGRAM_NAME).c
     35 	avr-objcopy -j .text -j .data -O ihex $(BUILD_DIR)/$(PROGRAM_NAME).elf $(BUILD_DIR)/$(PROGRAM_NAME).hex
     36 
     37 upload: $(PROGRAM_NAME)
     38 	$(SUDOCMD) avrdude -p $(MCUSHORT) $(PROG_PARAMS) -U flash:w:$(BUILD_DIR)/$(PROGRAM_NAME).hex:i
     39 
     40 clean:
     41 	rm -rf $(BUILD_DIR)