forked from LenShustek/ATtiny-playtune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (25 loc) · 799 Bytes
/
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
TARGET_DEVICE ?= attiny85
CPUFREQ ?= 16500000
CPPFLAGS += -Wall -Wextra -pedantic -Werror
CFLAGS += -std=c99
CPPFLAGS += -Os
CPPFLAGS += -g
.PHONY: all
all: menorah_03.hex
menorah_03: CC := avr-gcc
menorah_03: CXX := avr-g++
menorah_03: CPPFLAGS += -mmcu=$(TARGET_DEVICE) -DF_CPU=$(CPUFREQ)
menorah_03: LDFLAGS += -mmcu=$(TARGET_DEVICE)
menorah_03: CPPFLAGS += -mcall-prologues
menorah_03: LDFLAGS += -mcall-prologues
menorah_03.hex: menorah_03
avr-nm --size-sort $< | awk '{ s=strtonum("0x" $$1); sum[tolower($$2)]+=s; print s, $$2, $$3} END { for (s in sum) print sum[s], s, "total" }' | avr-c++filt
avr-size $<
avr-objcopy -O ihex -R .eeprom $< $@
.PHONY: clean
clean:
rm -f menorah_03 *.hex
.PHONY: deploy
deploy: menorah_03.hex
stdbuf -o0 micronucleus $<
@echo "Disconnect USB now!"