forked from SuperFabius/Z80-MBC2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (41 loc) · 1.53 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
#################################
# Makefile for project Z80-MBC2 #
# build with arduino-cli #
# under Debian Linux (stable) #
#################################
# IOS project
PRJ = S220718-R290823_IOS-Z80-MBC2
# IOS-LITE project
# PRJ = S220618_IOS-LITE-Z80-MBC2
# fully qualified board name for ATmega32
FQBN = MightyCore:avr:32
# default clock 16 MHz
# CLK = 16
# overclock 20 MHz
# https://hackaday.io/project/159973-z80-mbc2-a-4-ics-homebrew-z80-computer/details
CLK = 20
#############################################
## normally no need to change something below
#############################################
# build options, copied from Arduino GUI build
BUILDOPTIONS = bootloader=uart0,eeprom=keep,baudrate=default,SerialBuf=SB256_64,pinout=standard,BOD=2v7,LTO=Os_flto,clock=$(CLK)MHz_external
# fully qualified board name with build options
FQBN_BO = "$(FQBN):$(BUILDOPTIONS)"
# build directory inside the project directory
BUILD = $(PRJ)/build/$(subst :,.,$(FQBN))
# source code for the Arduino project
INO = $(PRJ)/$(PRJ).ino
# target in intel hex format
HEX = $(BUILD)/$(PRJ).ino.hex
HEX_BL = $(BUILD)/$(PRJ).ino.with_bootloader.hex
HEX_BL_CLK = $(PRJ)/$(PRJ).ino.with_bootloader_$(CLK)MHz.hex
.PHONY: compile
compile: $(HEX_BL_CLK)
$(HEX_BL_CLK): $(INO) Makefile
arduino-cli compile --export-binaries --warnings all --fqbn $(FQBN_BO) $(INO)
-rm $(HEX_BL_CLK)
-ln $(HEX_BL) $(HEX_BL_CLK)
.PHONY: burn-bootloader
burn-bootloader: $(HEX_BL_CLK)
#arduino-cli burn-bootloader --fqbn $(FQBN_BO) -
avrdude -pm32 -U $(HEX_BL_CLK)