-
Notifications
You must be signed in to change notification settings - Fork 76
/
Makefile
86 lines (74 loc) · 2.47 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
TARGET_DIR = bin
BOARD ?= STM32F469DISC
FLAVOR ?= SPECTER
USER_C_MODULES ?= ../../../usermods
MPY_DIR ?= f469-disco/micropython
FROZEN_MANIFEST_DISCO ?= ../../../../manifests/disco.py
FROZEN_MANIFEST_DEBUG ?= ../../../../manifests/debug.py
FROZEN_MANIFEST_UNIX ?= ../../../../manifests/unix.py
DEBUG ?= 0
USE_DBOOT ?= 0
$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
# check submodules
$(MPY_DIR)/mpy-cross/Makefile:
git submodule update --init --recursive
# cross-compiler
mpy-cross: $(TARGET_DIR) $(MPY_DIR)/mpy-cross/Makefile
@echo Building cross-compiler
make -C $(MPY_DIR)/mpy-cross \
DEBUG=$(DEBUG) && \
cp $(MPY_DIR)/mpy-cross/mpy-cross $(TARGET_DIR)
# disco board with bitcoin library
disco: $(TARGET_DIR) mpy-cross $(MPY_DIR)/ports/stm32
@echo Building firmware
make -C $(MPY_DIR)/ports/stm32 \
BOARD=$(BOARD) \
FLAVOR=$(FLAVOR) \
USE_DBOOT=$(USE_DBOOT) \
USER_C_MODULES=$(USER_C_MODULES) \
FROZEN_MANIFEST=$(FROZEN_MANIFEST_DISCO) \
DEBUG=$(DEBUG) && \
arm-none-eabi-objcopy -O binary \
$(MPY_DIR)/ports/stm32/build-STM32F469DISC/firmware.elf \
$(TARGET_DIR)/specter-diy.bin && \
cp $(MPY_DIR)/ports/stm32/build-STM32F469DISC/firmware.hex \
$(TARGET_DIR)/specter-diy.hex
# disco board with bitcoin library
debug: $(TARGET_DIR) mpy-cross $(MPY_DIR)/ports/stm32
@echo Building firmware
make -C $(MPY_DIR)/ports/stm32 \
BOARD=$(BOARD) \
FLAVOR=$(FLAVOR) \
USE_DBOOT=$(USE_DBOOT) \
USER_C_MODULES=$(USER_C_MODULES) \
FROZEN_MANIFEST=$(FROZEN_MANIFEST_DEBUG) \
DEBUG=$(DEBUG) && \
arm-none-eabi-objcopy -O binary \
$(MPY_DIR)/ports/stm32/build-STM32F469DISC/firmware.elf \
$(TARGET_DIR)/debug.bin && \
cp $(MPY_DIR)/ports/stm32/build-STM32F469DISC/firmware.hex \
$(TARGET_DIR)/debug.hex
# unixport (simulator)
unix: $(TARGET_DIR) mpy-cross $(MPY_DIR)/ports/unix
@echo Building binary with frozen files
make -C $(MPY_DIR)/ports/unix \
USER_C_MODULES=$(USER_C_MODULES) \
FROZEN_MANIFEST=$(FROZEN_MANIFEST_UNIX) && \
cp $(MPY_DIR)/ports/unix/micropython $(TARGET_DIR)/micropython_unix
simulate: unix
$(TARGET_DIR)/micropython_unix simulate.py
test: unix
$(TARGET_DIR)/micropython_unix tests/run_tests.py
all: mpy-cross disco unix
clean:
rm -rf $(TARGET_DIR)
make -C $(MPY_DIR)/mpy-cross clean
make -C $(MPY_DIR)/ports/unix \
USER_C_MODULES=$(USER_C_MODULES) \
FROZEN_MANIFEST=$(FROZEN_MANIFEST_UNIX) clean
make -C $(MPY_DIR)/ports/stm32 \
BOARD=$(BOARD) \
USER_C_MODULES=$(USER_C_MODULES) \
FROZEN_MANIFEST=$(FROZEN_MANIFEST_DISCO) clean
.PHONY: all clean