-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (105 loc) · 3.69 KB
/
Makefile
File metadata and controls
142 lines (105 loc) · 3.69 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Check if BOLOS SDK isn't defined
ifeq ($(BOLOS_SDK),)
# Display error
$(error Environment variable BOLOS_SDK is not set)
endif
# Include BOLOS SDK Makefile target
include $(BOLOS_SDK)/Makefile.target
# Application version
APPVERSION_M = 7
APPVERSION_N = 6
APPVERSION_P = 0
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"
# Check if currency isn't defined
ifndef CURRENCY
# Set currency to MimbleWimble Coin
CURRENCY = mimblewimble_coin
endif
# Check if currency is MimbleWimble Coin
ifeq ($(CURRENCY),mimblewimble_coin)
# Application name
APPNAME = "MimbleWimble Coin"
# 44'/593' path on secp256k1 curve
CURVE_APP_LOAD_PARAMS = secp256k1
PATH_APP_LOAD_PARAMS = "44'/593'"
# Defines
DEFINES += CURRENCY_BIP44_COIN_TYPE=593
DEFINES += CURRENCY_MQS_VERSION=\{1,69\}
DEFINES += CURRENCY_NAME=\"MimbleWimble\\x20\\x43oin\"
DEFINES += CURRENCY_ABBREVIATION=\"MWC\"
# Otherwise check if currency is MimbleWimble Coin floonet
else ifeq ($(CURRENCY),mimblewimble_coin_floonet)
# Application name
APPNAME = "MimbleWimble Coin Floonet"
# 44'/1' path on secp256k1 curve
CURVE_APP_LOAD_PARAMS = secp256k1
PATH_APP_LOAD_PARAMS = "44'/1'"
# Defines
DEFINES += CURRENCY_BIP44_COIN_TYPE=1
DEFINES += CURRENCY_MQS_VERSION=\{1,121\}
DEFINES += CURRENCY_NAME=\"MimbleWimble\\x20\\x43oin\\x20\\x46loonet\"
DEFINES += CURRENCY_ABBREVIATION=\"Floonet\\x20MWC\"
# Otherwise
else
# Display error
$(error Unsupported CURRENCY - use mimblewimble_coin or mimblewimble_coin_floonet)
endif
# Defines
DEFINES += HAVE_BOLOS_APP_STACK_CANARY
# Check if target is the Stax, Flex, or Apex P
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX TARGET_APEX_P))
# Defines
DEFINES += CURRENCY_ICON_DETAILS=C_icon_mimblewimble_coin_big
# Otherwise
else
# Defines
DEFINES += CURRENCY_ICON_DETAILS=C_icon_mimblewimble_coin
endif
# Icons
ICON_NANOS = "icons/nanos_app.gif"
ICON_NANOX = "icons/nanox_app.gif"
ICON_NANOSP = "icons/nanosplus_app.gif"
ICON_STAX = "icons/stax_app.png"
ICON_FLEX = "icons/flex_app.png"
ICON_APEX_P = "icons/apexp_app.png"
# Application source files
APP_SOURCE_PATH += src
INCLUDES_PATH += $(BOLOS_SDK)/lib_cxng/src
APP_SOURCE_FILES += $(BOLOS_SDK)/lib_cxng/src/cx_ram.c $(BOLOS_SDK)/lib_cxng/src/cx_blake2b.c
# Check if target isn't the Nano S (The Ledger Nano S SDK doesn't include support for ChaCha20 Poly1305)
ifneq ($(TARGET_NAME),TARGET_NANOS)
# Application source files
APP_SOURCE_FILES += $(BOLOS_SDK)/lib_cxng/src/cx_chacha.c $(BOLOS_SDK)/lib_cxng/src/cx_poly1305.c $(BOLOS_SDK)/lib_cxng/src/cx_chacha_poly.c
DEFINES += HAVE_CHACHA HAVE_POLY1305 HAVE_CHACHA_POLY
endif
# Variants
VARIANT_PARAM = CURRENCY
VARIANT_VALUES = mimblewimble_coin mimblewimble_coin_floonet
# Enable features
ENABLE_BLUETOOTH = 1
ENABLE_NBGL_QRCODE = 1
# Check if BOLOS ENV is defined
ifneq ($(BOLOS_ENV),)
# Set compiler paths
CLANGPATH = $(BOLOS_ENV)/clang-arm-fropi/bin/
GCCPATH = $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/
endif
# Emulator flags
EMULATOR_FLAGS = --model `echo $(subst TARGET_, ,$(TARGET_NAME)) | tr 2 P | tr A-Z a-z` --seed "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
# Check if target version is defined
ifneq ($(TARGET_VERSION),)
# SDK emulator flag
EMULATOR_FLAGS += --sdk $(subst $(eval) ,.,$(wordlist 1,2,$(subst ., ,$(TARGET_VERSION))))
endif
# Make command
all: default
# Run command
run: all
# Run application in emulator
SPECULOS_APPNAME=$(APPNAME):$(APPVERSION) $(BOLOS_EMU)/speculos.py bin/app.elf $(EMULATOR_FLAGS)
# Functional tests
functional_tests: all
# Run functional tests
node tests/functional_tests/main.js $(CURRENCY)
# Include BOLOS SDK Makefile standard app
include $(BOLOS_SDK)/Makefile.standard_app