Skip to content

Commit b3bdffb

Browse files
committed
Modify Makefile and app dashboard to be generic
1 parent 673b46f commit b3bdffb

File tree

4 files changed

+43
-53
lines changed

4 files changed

+43
-53
lines changed

Makefile

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515
# limitations under the License.
1616
# ****************************************************************************
1717

18+
ifndef APPVERSION
19+
$(error "APPVERSION is not defined")
20+
endif
21+
22+
ifndef APPNAME
23+
$(error "APPNAME is not defined")
24+
endif
25+
26+
ifndef APP_DESCRIPTION
27+
$(error "APP_DESCRIPTION is not defined")
28+
endif
29+
30+
ifeq ($(filter mainnet testnet,$(BITCOIN_NETWORK)),)
31+
$(error "BITCOIN_NETWORK must be either mainnet or testnet")
32+
endif
33+
1834
ifeq ($(BOLOS_SDK),)
1935
$(error Environment variable BOLOS_SDK is not set)
2036
endif
@@ -41,15 +57,6 @@ CURVE_APP_LOAD_PARAMS = secp256k1
4157
# Application allowed derivation paths.
4258
PATH_APP_LOAD_PARAMS = ""
4359

44-
# Allowed SLIP21 paths
45-
PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"
46-
47-
# Application version
48-
APPVERSION_M = 2
49-
APPVERSION_N = 4
50-
APPVERSION_P = 0
51-
APPVERSION_SUFFIX = rc # if not empty, appended at the end. Do not add a dash.
52-
5360
ifeq ($(APPVERSION_SUFFIX),)
5461
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"
5562
else
@@ -63,34 +70,27 @@ ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
6370
DEFINES += HAVE_AUTOAPPROVE_FOR_PERF_TESTS
6471
endif
6572

66-
# Setting to allow building variant applications
67-
VARIANT_PARAM = COIN
68-
VARIANT_VALUES = bitcoin_testnet bitcoin
69-
70-
# simplify for tests
71-
ifndef COIN
72-
COIN=bitcoin_testnet
73-
endif
74-
7573
########################################
7674
# Application custom permissions #
7775
########################################
7876
HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
7977
HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
8078
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
81-
HAVE_APPLICATION_FLAG_LIBRARY = 1
79+
HAVE_APPLICATION_FLAG_LIBRARY = 0
80+
81+
$(info APP_DESCRIPTION is $(APP_DESCRIPTION))
8282

83-
ifeq ($(COIN),bitcoin_testnet)
83+
CFLAGS += -DAPP_DESCRIPTION=\"$(APP_DESCRIPTION)\"
84+
85+
ifeq ($(BITCOIN_NETWORK),testnet)
8486
# Bitcoin testnet, no legacy support
8587
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
8688
DEFINES += BIP44_COIN_TYPE=1
8789
DEFINES += COIN_P2PKH_VERSION=111
8890
DEFINES += COIN_P2SH_VERSION=196
8991
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
9092
DEFINES += COIN_COINID_SHORT=\"TEST\"
91-
92-
APPNAME = "Bitcoin Test"
93-
else ifeq ($(COIN),bitcoin)
93+
else ifeq ($(BITCOIN_NETWORK),mainnet)
9494
# the version for performance tests automatically approves all requests
9595
# there is no reason to ever compile the mainnet app with this flag
9696
ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
@@ -109,23 +109,16 @@ else ifeq ($(COIN),bitcoin)
109109

110110
else
111111
ifeq ($(filter clean,$(MAKECMDGOALS)),)
112-
$(error Unsupported COIN - use bitcoin_testnet, bitcoin)
112+
$(error Unsupported network)
113113
endif
114114
endif
115115

116116
ifneq (,$(filter-out clean,$(MAKECMDGOALS)))
117117
ifeq ($(TARGET_NAME),TARGET_NANOS)
118-
$(error This branch is not compatible with the Nano S device. Checkout the 'nanos' branch for the latest code for Nano S.)
118+
$(error This app is not compatible with the Nano S device.)
119119
endif
120120
endif
121121

122-
# Application icons following guidelines:
123-
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
124-
ICON_NANOX = icons/nanox_app_bitcoin.gif
125-
ICON_NANOSP = icons/nanox_app_bitcoin.gif
126-
ICON_STAX = icons/stax_app_bitcoin.gif
127-
ICON_FLEX = icons/flex_app_bitcoin.gif
128-
129122
########################################
130123
# Application communication interfaces #
131124
########################################
@@ -151,9 +144,6 @@ DEFINES += HAVE_BOLOS_APP_STACK_CANARY
151144

152145
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
153146

154-
# debugging helper functions and macros
155-
CFLAGS += -include debug-helpers/debug.h
156-
157147
# DEFINES += HAVE_PRINT_STACK_POINTER
158148

159149
ifeq ($(DEBUG),10)

src/ui/display_nbgl.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ void ui_accept_transaction_simplified_flow(void) {
220220

221221
nbgl_useCaseReview(TYPE_TRANSACTION,
222222
&pairList,
223-
&C_Bitcoin_64px,
223+
&C_App_64px,
224224
"Review transaction\nto send Bitcoin",
225225
NULL,
226226
"Sign transaction\nto send Bitcoin?",
@@ -229,7 +229,7 @@ void ui_accept_transaction_simplified_flow(void) {
229229

230230
void ui_display_transaction_prompt(void) {
231231
nbgl_useCaseReviewStreamingStart(TYPE_TRANSACTION,
232-
&C_Bitcoin_64px,
232+
&C_App_64px,
233233
"Review transaction\nto send Bitcoin",
234234
NULL,
235235
start_transaction_callback);
@@ -293,7 +293,7 @@ void ui_display_pubkey_flow(void) {
293293

294294
nbgl_useCaseReviewLight(TYPE_OPERATION,
295295
&pairList,
296-
&C_Bitcoin_64px,
296+
&C_App_64px,
297297
"Confirm public key",
298298
NULL,
299299
"Approve public key",
@@ -312,7 +312,7 @@ void ui_display_receive_in_wallet_flow(void) {
312312

313313
nbgl_useCaseAddressReview(g_ui_state.wallet.address,
314314
&pairList,
315-
&C_Bitcoin_64px,
315+
&C_App_64px,
316316
"Verify Bitcoin\naddress",
317317
NULL,
318318
status_address_callback);
@@ -356,7 +356,7 @@ void ui_display_register_wallet_policy_flow(void) {
356356

357357
nbgl_useCaseReviewLight(TYPE_OPERATION,
358358
&pairList,
359-
&C_Bitcoin_64px,
359+
&C_App_64px,
360360
"Review account\nto register",
361361
NULL,
362362
"Register account?",
@@ -381,7 +381,7 @@ void ui_display_pubkey_suspicious_flow(void) {
381381
pairList.pairs = pairs;
382382

383383
contentList[0].type = CENTERED_INFO;
384-
contentList[0].content.centeredInfo.icon = &C_Bitcoin_64px;
384+
contentList[0].content.centeredInfo.icon = &C_App_64px;
385385
contentList[0].content.centeredInfo.text1 = "Confirm public key";
386386
contentList[0].content.centeredInfo.text2 = NULL;
387387
contentList[0].content.centeredInfo.text3 = NULL;
@@ -404,7 +404,7 @@ void ui_display_pubkey_suspicious_flow(void) {
404404

405405
contentList[3].type = INFO_BUTTON;
406406
contentList[3].content.infoButton.text = "Approve public key";
407-
contentList[3].content.infoButton.icon = &C_Bitcoin_64px;
407+
contentList[3].content.infoButton.icon = &C_App_64px;
408408
contentList[3].content.infoButton.buttonText = "Approve";
409409
contentList[3].content.infoButton.buttonToken = REVIEW_CONFIRM;
410410
contentList[3].content.infoButton.tuneId = TUNE_TAP_CASUAL;
@@ -478,7 +478,7 @@ void ui_sign_message_content_flow(void) {
478478
if (show_message_start_page == true) {
479479
show_message_start_page = false;
480480
nbgl_useCaseReviewStreamingStart(TYPE_MESSAGE,
481-
&C_Bitcoin_64px,
481+
&C_App_64px,
482482
"Review message",
483483
NULL,
484484
message_display_content);
@@ -489,7 +489,7 @@ void ui_sign_message_content_flow(void) {
489489

490490
void ui_sign_message_path_hash_and_confirm_flow(void) {
491491
nbgl_useCaseReviewStreamingStart(TYPE_MESSAGE,
492-
&C_Bitcoin_64px,
492+
&C_App_64px,
493493
"Review message",
494494
NULL,
495495
message_display_path);
@@ -518,7 +518,7 @@ void ui_display_spend_from_wallet_flow(void) {
518518

519519
nbgl_useCaseReviewLight(TYPE_OPERATION,
520520
&pairList,
521-
&C_Bitcoin_64px,
521+
&C_App_64px,
522522
"Spend from\nknown account",
523523
NULL,
524524
"Confirm account name",
@@ -529,7 +529,7 @@ void ui_display_spend_from_wallet_flow(void) {
529529
void ui_display_default_wallet_address_flow(void) {
530530
nbgl_useCaseAddressReview(g_ui_state.wallet.address,
531531
NULL,
532-
&C_Bitcoin_64px,
532+
&C_App_64px,
533533
"Verify Bitcoin\naddress",
534534
NULL,
535535
status_address_callback);

src/ui/menu_bagl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
// We have a screen with the icon and "Bitcoin is ready" for Bitcoin,
2626
// "Bitcoin Testnet is ready" for Bitcoin Testnet.
27-
UX_STEP_NOCB(ux_menu_ready_step_bitcoin, pnn, {&C_bitcoin_logo, "Bitcoin", "is ready"});
27+
UX_STEP_NOCB(ux_menu_ready_step_bitcoin, pnn, {&C_app_logo, APPNAME, "is ready"});
2828
UX_STEP_NOCB(ux_menu_ready_step_bitcoin_testnet,
2929
pnn,
30-
{&C_bitcoin_logo, "Bitcoin Testnet", "is ready"});
30+
{&C_app_logo, APPNAME, "is ready"});
3131

3232
UX_STEP_NOCB(ux_menu_version_step, bn, {"Version", APPVERSION});
3333
UX_STEP_CB(ux_menu_about_step, pb, ui_menu_about(), {&C_icon_certificate, "About"});
@@ -57,7 +57,7 @@ UX_FLOW(ux_menu_main_flow_bitcoin_testnet,
5757
&ux_menu_exit_step,
5858
FLOW_LOOP);
5959

60-
UX_STEP_NOCB(ux_menu_info_step, bn, {"Bitcoin App", "(c) 2024 Ledger"});
60+
UX_STEP_NOCB(ux_menu_info_step, bn, {APPNAME, "(c) 2024 Ledger"});
6161
UX_STEP_CB(ux_menu_back_step, pb, ui_menu_main(), {&C_icon_back, "Back"});
6262

6363
// FLOW for the about submenu:

src/ui/menu_nbgl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void exit(void) {
3737

3838
void ui_menu_main_flow_bitcoin(void) {
3939
nbgl_useCaseHomeAndSettings(APPNAME,
40-
&C_Bitcoin_64px,
40+
&C_App_64px,
4141
NULL,
4242
INIT_HOME_PAGE,
4343
NULL,
@@ -48,9 +48,9 @@ void ui_menu_main_flow_bitcoin(void) {
4848

4949
void ui_menu_main_flow_bitcoin_testnet(void) {
5050
nbgl_useCaseHomeAndSettings(
51-
"Bitcoin Testnet",
52-
&C_Bitcoin_64px,
53-
"This app enables signing\ntransactions on all the Bitcoin\ntest networks.",
51+
APPNAME,
52+
&C_App_64px,
53+
APP_DESCRIPTION,
5454
INIT_HOME_PAGE,
5555
NULL,
5656
&infoList,

0 commit comments

Comments
 (0)