forked from numist/is31io7326_clone
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
73 lines (53 loc) · 2.28 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
default: all
# Name: Makefile
# Author: Scott Perry <[email protected]>
# Copyright: 2015
# License: MIT
# You should at least check the settings for
# DEVICE ....... The AVR device you compile for
# CLOCK ........ Target AVR clock rate in Hertz
# PROGRAMMER ... Options to avrdude which define the hardware you use for
# uploading to the AVR and the interface where this hardware
# is connected. We recommend that you leave it undefined and
# add settings like this to your ~/.avrduderc file:
# default_programmer = "dragon_isp";
# default_serial = "usb";
# FUSES ........ Parameters for avrdude to flash the fuses appropriately.
PRODUCT_ID ?= keyboardio-model-100
DEVICE ?= attiny88
OUTPUT_DIR ?= $(PRODUCT_ID)-flash-$(DEVICE)
# 8Mhz
CLOCK ?= 8000000
# For computing fuse byte values for other devices and options see
# the fuse bit calculator at http://www.engbedded.com/fusecalc/
FUSES = -U lfuse:w:0xee:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m
AVRDUDE_PATH ?= avrdude
GCC_PATH ?= avr-gcc
PROGRAMMER ?= -c usbtiny
AVRDUDE = $(AVRDUDE_PATH) $(PROGRAMMER) -p $(DEVICE) -v
PYTHON = python3
flash: all
$(AVRDUDE) -B 2 -U flash:w:out/$(OUTPUT_DIR)/$(DEVICE)_factory.hex:i
fuse:
$(AVRDUDE) -B 100 $(FUSES)
# Xcode uses the Makefile targets "", "clean" and "install"
install: all fuse flash
clean:
make -C firmware clean
rm -fr out/*
all: build flashing-tool
build:
make -C firmware PRODUCT_ID=$(PRODUCT_ID)
mkdir -p out/$(OUTPUT_DIR)
cp firmware/main.hex out/$(OUTPUT_DIR)/$(DEVICE)_keyscanner.hex
cp etc/bootloaders/$(PRODUCT_ID).hex firmware/bootloader.hex
./tools/make_factory_firmware.py > out/$(OUTPUT_DIR)/$(DEVICE)_factory.hex
cp etc/bootloaders/$(PRODUCT_ID).hex out/$(OUTPUT_DIR)/$(DEVICE)_bootloader.hex
flashing-tool: build
mkdir -p out/$(OUTPUT_DIR)/$(DEVICE)_flasher
cp etc/flasher_Makefile out/$(OUTPUT_DIR)/$(DEVICE)_flasher/Makefile
cp etc/flash_firmware.ino out/$(OUTPUT_DIR)/$(DEVICE)_flasher/$(DEVICE)_flasher.ino
$(PYTHON) ./tools/hex_to_atmega.py out/$(OUTPUT_DIR)/$(DEVICE)_keyscanner.hex > out/$(OUTPUT_DIR)/$(DEVICE)_flasher/$(DEVICE)_flasher.h
mkdir -p out/dist
cd out && tar czf dist/$(DEVICE)_firmware-`git describe`.tar.gz $(OUTPUT_DIR)
.PHONY: default all clean install flash fuse