forked from keirf/flashfloppy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
106 lines (84 loc) · 3.21 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
export FW_VER := 4.4a
PROJ := FlashFloppy
VER := v$(FW_VER)
PYTHON := python3
export ROOT := $(CURDIR)
.PHONY: FORCE
.DEFAULT_GOAL := all
prod-%: FORCE
$(MAKE) target mcu=$* target=bootloader level=prod
$(MAKE) target mcu=$* target=floppy level=prod
$(MAKE) target mcu=$* target=quickdisk level=prod
$(MAKE) target mcu=$* target=bl_update level=prod
$(MAKE) target mcu=$* target=io_test level=prod
debug-%: FORCE
$(MAKE) target mcu=$* target=bootloader level=debug
$(MAKE) target mcu=$* target=floppy level=debug
$(MAKE) target mcu=$* target=quickdisk level=debug
$(MAKE) target mcu=$* target=bl_update level=debug
$(MAKE) target mcu=$* target=io_test level=debug
logfile-%: FORCE
$(MAKE) target mcu=$* target=bootloader level=logfile
$(MAKE) target mcu=$* target=floppy level=logfile
$(MAKE) target mcu=$* target=quickdisk level=logfile
all-%: FORCE prod-% debug-% logfile-% ;
all: FORCE all-stm32f105 all-at32f435 ;
clean: FORCE
rm -rf out
mrproper: FORCE clean
rm -rf ext
out: FORCE
mkdir -p out/$(mcu)/$(level)/$(target)
rsync -a --include="*/" --exclude="*" src/ out/$(mcu)/$(level)/$(target)
target: FORCE out
$(MAKE) -C out/$(mcu)/$(level)/$(target) -f $(ROOT)/Rules.mk target.bin target.hex target.upd target.dfu $(mcu)=y $(level)=y $(target)=y
HXC_FF_URL := https://www.github.com/keirf/flashfloppy-hxc-file-selector
HXC_FF_URL := $(HXC_FF_URL)/releases/download
HXC_FF_VER := v9-FF
dist: level := prod
dist: mcu := stm32f105
dist: t := $(ROOT)/out/flashfloppy-$(VER)
dist: FORCE all
rm -rf out/flashfloppy-*
mkdir -p $(t)/alt/bootloader
mkdir -p $(t)/alt/logfile
mkdir -p $(t)/alt/io-test
mkdir -p $(t)/alt/quickdisk/logfile
cd out/$(mcu)/$(level)/floppy; \
cp -a target.dfu $(t)/FF_Gotek-$(VER).dfu; \
cp -a target.upd $(t)/FF_Gotek-$(VER).upd; \
cp -a target.hex $(t)/FF_Gotek-$(VER).hex
cd out/$(mcu)/$(level)/bootloader; \
cp -a target.upd $(t)/alt/bootloader/FF_Gotek-Bootloader-$(VER).upd
cd out/$(mcu)/$(level)/io_test; \
cp -a target.upd $(t)/alt/io-test/FF_Gotek-IO-Test-$(VER).upd
cd out/$(mcu)/logfile/floppy; \
cp -a target.upd $(t)/alt/logfile/FF_Gotek-Logfile-$(VER).upd
cd out/$(mcu)/$(level)/quickdisk; \
cp -a target.upd $(t)/alt/quickdisk/FF_Gotek-QuickDisk-$(VER).upd
cd out/$(mcu)/logfile/quickdisk; \
cp -a target.upd $(t)/alt/quickdisk/logfile/FF_Gotek-QuickDisk-Logfile-$(VER).upd
$(PYTHON) scripts/mk_qd.py --window=6.5 $(t)/alt/quickdisk/Blank.qd
cp -a COPYING $(t)/
cp -a README.md $(t)/
cp -a RELEASE_NOTES $(t)/
cp -a examples $(t)/
[ -e ext/HxC_Compat_Mode-$(HXC_FF_VER).zip ] || \
(mkdir -p ext ; cd ext ; wget -q --show-progress $(HXC_FF_URL)/$(HXC_FF_VER)/HxC_Compat_Mode-$(HXC_FF_VER).zip ; rm -rf index.html)
(cd $(t) && unzip -q ../../ext/HxC_Compat_Mode-$(HXC_FF_VER).zip)
mkdir -p $(t)/scripts
cp -a scripts/edsk* $(t)/scripts/
cp -a scripts/mk_hfe.py $(t)/scripts/
cd out && zip -r flashfloppy-$(VER).zip flashfloppy-$(VER)
BAUD=115200
DEV=/dev/ttyUSB0
SUDO=sudo
STM32FLASH=stm32flash
ocd: FORCE all
$(PYTHON) scripts/openocd/flash.py $(target)/target.hex
flash: FORCE all
$(SUDO) $(STM32FLASH) -b $(BAUD) -w $(target)/target.hex $(DEV)
start: FORCE
$(SUDO) $(STM32FLASH) -b $(BAUD) -g 0 $(DEV)
serial: FORCE
$(SUDO) miniterm.py $(DEV) 3000000