@@ -19,11 +19,11 @@ ifeq ($(BOLOS_SDK),)
1919$(error Environment variable BOLOS_SDK is not set)
2020endif
2121
22- # Application allowed derivation curves.
23- CURVE_APP_LOAD_PARAMS = secp256k1
22+ include $(BOLOS_SDK ) /Makefile.target
2423
25- # Allowed SLIP21 paths
26- PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"
24+ # #######################################
25+ # Mandatory configuration #
26+ # #######################################
2727
2828# Application version
2929APPVERSION_M = 2
3737APPVERSION = "$(APPVERSION_M ) .$(APPVERSION_N ) .$(APPVERSION_P ) -$(strip $(APPVERSION_SUFFIX ) ) "
3838endif
3939
40- # If set, the app will automatically approve all requests without user interaction. Useful for performance tests.
41- # It is critical that no such app is ever deployed in production.
42- AUTOAPPROVE_FOR_PERF_TESTS ?= 0
43- ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS ) ,0)
44- DEFINES += HAVE_AUTOAPPROVE_FOR_PERF_TESTS
45- endif
40+ # Application source files
41+ APP_SOURCE_PATH += src
42+
43+ # Application icons following guidelines:
44+ # https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
45+ ICON_NANOX = icons/nanox_app_bitcoin.gif
46+ ICON_NANOSP = icons/nanox_app_bitcoin.gif
47+ ICON_STAX = icons/stax_app_bitcoin.gif
48+ ICON_FLEX = icons/flex_app_bitcoin.gif
49+ ICON_APEX_P = icons/apex_p_app_bitcoin.png
50+
51+ # Application allowed derivation curves.
52+ CURVE_APP_LOAD_PARAMS = secp256k1
53+
54+ # Allowed SLIP21 paths
55+ PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"
4656
4757# Setting to allow building variant applications
4858VARIANT_PARAM = COIN
@@ -53,58 +63,32 @@ ifndef COIN
5363COIN =bitcoin_testnet
5464endif
5565
56- # #######################################
57- # Application custom permissions #
58- # #######################################
59- HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
60- HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
61- HAVE_APPLICATION_FLAG_LIBRARY = 1
62-
66+ # Coin-specific configuration
6367ifeq ($(COIN ) ,bitcoin_testnet)
64- # Application allowed derivation paths (testnet) + exception for Electrum + BIP-45 whole tree
65- PATH_APP_LOAD_PARAMS = "*/1'" "4541509'" "45'"
66-
6768 # Bitcoin testnet, no legacy support
6869 DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
6970 DEFINES += BIP44_COIN_TYPE=1
7071 DEFINES += COIN_P2PKH_VERSION=111
7172 DEFINES += COIN_P2SH_VERSION=196
7273 DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
7374 DEFINES += COIN_COINID_SHORT=\"TEST\"
74-
7575 APPNAME = "Bitcoin Test"
76+ # Application allowed derivation paths (testnet) + exception for Electrum + BIP-45 whole tree
77+ PATH_APP_LOAD_PARAMS = "*/1'" "4541509'" "45'"
7678
7779else ifeq ($(COIN),bitcoin)
78- # Application allowed derivation paths (mainnet) + exception for Electrum + BIP-45 whole tree
79- PATH_APP_LOAD_PARAMS = "*/0'" "4541509'" "45'"
80-
81- # the version for performance tests automatically approves all requests
82- # there is no reason to ever compile the mainnet app with this flag
83- ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
84- $(error Use testnet app for performance tests)
85- endif
86-
8780 # Bitcoin mainnet, no legacy support
8881 DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
8982 DEFINES += BIP44_COIN_TYPE=0
9083 DEFINES += COIN_P2PKH_VERSION=0
9184 DEFINES += COIN_P2SH_VERSION=5
9285 DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
9386 DEFINES += COIN_COINID_SHORT=\"BTC\"
94-
9587 APPNAME = "Bitcoin"
88+ # Application allowed derivation paths (mainnet) + exception for Electrum + BIP-45 whole tree
89+ PATH_APP_LOAD_PARAMS = "*/0'" "4541509'" "45'"
9690
9791else ifeq ($(COIN),bitcoin_recovery)
98- # Application allowed derivation paths (all paths are permitted).
99- PATH_APP_LOAD_PARAMS = ""
100- HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
101-
102- # the version for performance tests automatically approves all requests
103- # there is no reason to ever compile the mainnet app with this flag
104- ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
105- $(error Use testnet app for performance tests)
106- endif
107-
10892 # Bitcoin mainnet, no legacy support
10993 DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
11094 DEFINES += BIP44_COIN_TYPE=0
@@ -113,8 +97,10 @@ else ifeq ($(COIN),bitcoin_recovery)
11397 DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
11498 DEFINES += COIN_COINID_SHORT=\"BTC\"
11599 DEFINES += BITCOIN_RECOVERY
116-
117100 APPNAME = "Bitcoin Recovery"
101+ # Application allowed derivation paths (all paths are permitted).
102+ PATH_APP_LOAD_PARAMS = ""
103+ HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
118104
119105else
120106 ifeq ($(filter clean,$(MAKECMDGOALS)),)
@@ -128,40 +114,64 @@ ifneq (,$(filter-out clean,$(MAKECMDGOALS)))
128114 endif
129115endif
130116
131- ENABLE_NBGL_FOR_NANO_DEVICES = 1
132-
133- # Application icons following guidelines:
134- # https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
135- ICON_NANOX = icons/nanox_app_bitcoin.gif
136- ICON_NANOSP = icons/nanox_app_bitcoin.gif
137- ICON_STAX = icons/stax_app_bitcoin.gif
138- ICON_FLEX = icons/flex_app_bitcoin.gif
139- ICON_APEX_P = icons/apex_p_app_bitcoin.png
117+ # #######################################
118+ # Application custom permissions #
119+ # #######################################
120+ # See SDK `include/appflags.h` for the purpose of each permission
121+ HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
122+ HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
123+ HAVE_APPLICATION_FLAG_LIBRARY = 1
140124
141125# #######################################
142126# Application communication interfaces #
143127# #######################################
144128ENABLE_BLUETOOTH = 1
129+ ENABLE_NBGL_FOR_NANO_DEVICES = 1
145130
146131# #######################################
147132# NBGL custom features #
148133# #######################################
149134ENABLE_NBGL_QRCODE = 1
150135
136+ # #######################################
137+ # SWAP FEATURE FLAG #
138+ # This flag enables the swap feature #
139+ # in the Boilerplate application. #
140+ # #######################################
141+ # Testing only SWAP flag
142+ # ENABLE_TESTING_SWAP = 1
143+ # Production enabled SWAP flag
144+ ENABLE_SWAP = 1
145+
151146# #######################################
152147# Features disablers #
153148# #######################################
154149# Don't use standard app file to avoid conflicts for now
155- DISABLE_STANDARD_APP_FILES = 1
150+ # DISABLE_STANDARD_APP_FILES = 1
156151
157152# Don't use default IO_SEPROXY_BUFFER_SIZE to use another
158153# value for NANOS for an unknown reason.
159- DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1
154+ # DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1
160155
156+ # #######################################
157+ # Application defines #
158+ # #######################################
161159DEFINES += HAVE_BOLOS_APP_STACK_CANARY
162160
163-
164- DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
161+ # If set, the app will automatically approve all requests without user interaction. Useful for performance tests.
162+ # It is critical that no such app is ever deployed in production.
163+ AUTOAPPROVE_FOR_PERF_TESTS ?= 0
164+ ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS ) ,0)
165+ DEFINES += HAVE_AUTOAPPROVE_FOR_PERF_TESTS
166+ # the version for performance tests automatically approves all requests
167+ # there is no reason to ever compile the mainnet app with this flag
168+ ifeq ($(COIN),bitcoin)
169+ $(error Use testnet app for performance tests)
170+ endif
171+ ifeq ($(COIN),bitcoin_recovery)
172+ $(error Use testnet app for performance tests)
173+ endif
174+ endif
165175
166176# debugging helper functions and macros
167177CFLAGS += -include debug-helpers/debug.h
@@ -175,21 +185,6 @@ endif
175185
176186# Needed to be able to include the definition of G_cx
177187INCLUDES_PATH += $(BOLOS_SDK ) /lib_cxng/src
178- INCLUDES_PATH += $(BOLOS_SDK ) /lib_standard_app
179-
180- # Application source files
181- APP_SOURCE_PATH += src
182- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/base58.c
183- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/bip32.c
184- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/buffer.c
185- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/format.c
186- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/parser.c
187- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/read.c
188- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/varint.c
189- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/write.c
190-
191- # Allow usage of function from lib_standard_app/crypto_helpers.c
192- APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/crypto_helpers.c
193188
194189# #######################################
195190# Features enablers #
0 commit comments