You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.0 KiB
79 lines
2.0 KiB
11 years ago
|
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||
|
|
||
11 years ago
|
#BOARD_TAG = keyboardio
|
||
10 years ago
|
BOARD = model01
|
||
9 years ago
|
MCU = atmega32u4
|
||
|
|
||
9 years ago
|
DEVICE_PORT := `ls /dev/cu.usbmodemHID??`
|
||
8 years ago
|
DEVICE_PORT := `ls /dev/cu.usbmodem1A12411`
|
||
|
DEVICE_PORT_BOOTLOADER := `ls /dev/cu.usbmodem1A12411`
|
||
11 years ago
|
ARDUINO_LIBS =
|
||
10 years ago
|
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)
|
||
9 years ago
|
|
||
8 years ago
|
ARDUINO_PATH=~/Applications/Arduino.app/Contents/Java/
|
||
9 years ago
|
ARDUINO_TOOLS_PATH=$(ARDUINO_PATH)/hardware/tools
|
||
9 years ago
|
FQBN=arduino:avr:leonardo
|
||
9 years ago
|
BUILD_PATH := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'build')
|
||
8 years ago
|
OUTPUT_PATH=../output
|
||
|
ARDUINO_LOCAL_LIB_PATH=../libraries
|
||
9 years ago
|
ARDUINO_IDE_VERSION=100607
|
||
9 years ago
|
VERBOSE= #-verbose
|
||
9 years ago
|
SKETCH=KeyboardioFirmware.ino
|
||
|
|
||
9 years ago
|
|
||
|
|
||
9 years ago
|
OUTPUT_FILE_PREFIX=$(SKETCH)-$(GIT_VERSION)
|
||
9 years ago
|
|
||
9 years ago
|
HEX_FILE_PATH=$(OUTPUT_PATH)/$(OUTPUT_FILE_PREFIX).hex
|
||
|
ELF_FILE_PATH=$(OUTPUT_PATH)/$(OUTPUT_FILE_PREFIX).elf
|
||
9 years ago
|
|
||
|
|
||
|
|
||
|
|
||
11 years ago
|
astyle:
|
||
9 years ago
|
find . -type f -name \*.cpp |xargs -n 1 astyle --style=google
|
||
|
find . -type f -name \*.ino |xargs -n 1 astyle --style=google
|
||
|
find . -type f -name \*.h |xargs -n 1 astyle --style=google
|
||
11 years ago
|
|
||
|
generate-keymaps:
|
||
9 years ago
|
-rm generated/keymaps.h
|
||
|
cd layouts && ( find . -type f |xargs -n 1 -I % sh -c 'perl ../tools/generate_keymaps.pl < % >> ../generated/keymaps.h' )
|
||
9 years ago
|
|
||
9 years ago
|
dirs:
|
||
|
mkdir -p $(OUTPUT_PATH)
|
||
|
|
||
9 years ago
|
build: compile size
|
||
|
|
||
9 years ago
|
compile: dirs
|
||
9 years ago
|
$(ARDUINO_PATH)/arduino-builder \
|
||
|
-hardware $(ARDUINO_PATH)/hardware \
|
||
9 years ago
|
-tools $(ARDUINO_TOOLS_PATH) \
|
||
9 years ago
|
-tools $(ARDUINO_PATH)/tools-builder \
|
||
|
-fqbn $(FQBN) \
|
||
|
-libraries $(ARDUINO_LOCAL_LIB_PATH) \
|
||
9 years ago
|
$(VERBOSE) \
|
||
9 years ago
|
-build-path $(BUILD_PATH) \
|
||
9 years ago
|
-ide-version $(ARDUINO_IDE_VERSION) \
|
||
|
$(SKETCH)
|
||
9 years ago
|
cp $(BUILD_PATH)/$(SKETCH).hex $(HEX_FILE_PATH)
|
||
|
cp $(BUILD_PATH)/$(SKETCH).elf $(ELF_FILE_PATH)
|
||
9 years ago
|
|
||
9 years ago
|
size: compile
|
||
9 years ago
|
$(ARDUINO_TOOLS_PATH)/avr/bin/avr-size -C --mcu=$(MCU) $(ELF_FILE_PATH)
|
||
9 years ago
|
|
||
|
reset-device:
|
||
9 years ago
|
-stty -f $(DEVICE_PORT) 1200 ;
|
||
9 years ago
|
|
||
|
flash: compile reset-device
|
||
|
sleep 3
|
||
9 years ago
|
$(ARDUINO_TOOLS_PATH)/avr/bin/avrdude \
|
||
|
-C$(ARDUINO_TOOLS_PATH)/avr/etc/avrdude.conf \
|
||
|
-v \
|
||
|
-p$(MCU) \
|
||
|
-cavr109 \
|
||
|
-P$(DEVICE_PORT_BOOTLOADER) \
|
||
|
-b57600 \
|
||
|
-D \
|
||
|
-Uflash:w:$(HEX_FILE_PATH):i
|
||
9 years ago
|
|