From 0016a0b46dc5db686e5b6c125272e02e24f890d7 Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Tue, 6 Feb 2024 17:45:20 +0100 Subject: [PATCH 1/2] Makefile.defines: Refactor UI defines per target --- Makefile.defines | 55 +++++++++++++++++++++++-------------------- Makefile.glyphs | 2 +- Makefile.rules | 2 +- Makefile.standard_app | 2 +- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/Makefile.defines b/Makefile.defines index efb30fa2b..6bf5c190a 100644 --- a/Makefile.defines +++ b/Makefile.defines @@ -30,11 +30,6 @@ ifeq ($(filter $(TARGET),$(TARGETS)),) $(error TARGET not set to a valid value (possible values: $(TARGETS))) endif -# for Stax, NBGL must be used -ifeq ($(TARGET),stax) -USE_NBGL ?= 1 -endif - API_LEVEL := 0 TARGET_PATH := $(BOLOS_SDK)/target/$(TARGET) TARGET_ID := $(shell cat $(TARGET_PATH)/include/bolos_target.h | grep TARGET_ID | cut -f3 -d' ') @@ -171,7 +166,10 @@ endif DISABLE_UI ?= 0 ifeq ($(DISABLE_UI),0) + ifeq ($(TARGET_NAME),TARGET_STAX) +# For Stax NBGL must be used +USE_NBGL = 1 DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_24PX DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_24PX DEFINES += HAVE_BAGL_FONT_INTER_MEDIUM_32PX @@ -182,32 +180,39 @@ DEFINES += HAVE_SE_TOUCH DEFINES += NBGL_PAGE DEFINES += NBGL_USE_CASE DEFINES += SCREEN_SIZE_WALLET -#DEFINES += HAVE_DISPLAY_FAST_MODE -else +endif # TARGET_STAX + +# For other devices, by default NBGL is not used +USE_NBGL ?= 0 + +ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2)) +DEFINES += BAGL_HEIGHT=64 DEFINES += BAGL_WIDTH=128 +DEFINES += HAVE_BAGL_ELLIPSIS +DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX +DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX +DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX DEFINES += SCREEN_SIZE_NANO -ifdef USE_NBGL + +ifeq ($(USE_NBGL),0) +DEFINES += HAVE_BAGL +DEFINES += HAVE_UX_FLOW +else DEFINES += HAVE_NBGL DEFINES += NBGL_STEP DEFINES += NBGL_USE_CASE -else -DEFINES += HAVE_BAGL -endif +endif # USE_NBGL + +endif # TARGET_NANOX / TARGET_NANOS2 + ifeq ($(TARGET_NAME),TARGET_NANOS) DEFINES += BAGL_HEIGHT=32 -endif -ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2)) -ifndef USE_NBGL -DEFINES += HAVE_UX_FLOW -endif -DEFINES += BAGL_HEIGHT=64 -DEFINES += HAVE_BAGL_ELLIPSIS -DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX -DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX -DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX -endif -endif -endif +DEFINES += BAGL_WIDTH=128 +DEFINES += SCREEN_SIZE_NANO +DEFINES += HAVE_BAGL +endif # TARGET_NANOS + +endif # DISABLE_UI ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2)) # Screen is directly connected to the SE @@ -217,8 +222,6 @@ DEFINES += HAVE_SE_BUTTON # MCU serial is stored on board of the SE DEFINES += HAVE_MCU_SERIAL_STORAGE DEFINES += HAVE_FONTS -# already defined within apps -# DEFINES += HAVE_BLE DEFINES += HAVE_INAPP_BLE_PAIRING DEFINES += HAVE_BATTERY endif diff --git a/Makefile.glyphs b/Makefile.glyphs index 6c172fdb7..4c8fd65e8 100644 --- a/Makefile.glyphs +++ b/Makefile.glyphs @@ -34,7 +34,7 @@ GLYPH_DESTH := $(GLYPH_SRC_DIR)/glyphs.h # search icons (glyphs) in glyphs folder of the app first GLYPH_FILES += $(addprefix glyphs/,$(sort $(notdir $(shell find glyphs/)))) -ifdef USE_NBGL +ifneq ($(USE_NBGL),0) # NBGL glyphs files and generation script # # search icons (glyphs) in lib_nbgl/glyphs(_nano) folder of the SDK diff --git a/Makefile.rules b/Makefile.rules index 565c115b9..a4f8ac1e5 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -17,7 +17,7 @@ # temporary redef, to ensure wider compliance of the SDK with pre-1.6 apps ifeq ($(DISABLE_UI),0) - ifndef USE_NBGL + ifeq ($(USE_NBGL),0) SDK_SOURCE_PATH += lib_bagl lib_ux else SDK_SOURCE_PATH += lib_nbgl lib_ux_stax diff --git a/Makefile.standard_app b/Makefile.standard_app index 29cd89b8d..a880033f0 100644 --- a/Makefile.standard_app +++ b/Makefile.standard_app @@ -111,7 +111,7 @@ ifneq ($(DISABLE_STANDARD_WEBUSB), 1) endif ifneq ($(DISABLE_STANDARD_BAGL_UX_FLOW), 1) -ifndef USE_NBGL +ifeq ($(USE_NBGL),0) DEFINES += HAVE_UX_FLOW endif endif From 2b4d13134fc2571660a269b6e5eac4a293a06090 Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Wed, 7 Feb 2024 11:13:23 +0100 Subject: [PATCH 2/2] Makefiles: Remove DISABLE_UI feature --- Makefile.defines | 5 ----- Makefile.rules | 10 ++++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Makefile.defines b/Makefile.defines index 6bf5c190a..a7f17f80c 100644 --- a/Makefile.defines +++ b/Makefile.defines @@ -164,9 +164,6 @@ LDFLAGS += -L$(BOLOS_SDK)/arch/st33k1/lib/ AFLAGS += -mcpu=cortex-m35p+nodsp -mthumb endif -DISABLE_UI ?= 0 -ifeq ($(DISABLE_UI),0) - ifeq ($(TARGET_NAME),TARGET_STAX) # For Stax NBGL must be used USE_NBGL = 1 @@ -212,8 +209,6 @@ DEFINES += SCREEN_SIZE_NANO DEFINES += HAVE_BAGL endif # TARGET_NANOS -endif # DISABLE_UI - ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2)) # Screen is directly connected to the SE DEFINES += HAVE_SE_SCREEN diff --git a/Makefile.rules b/Makefile.rules index a4f8ac1e5..f802e9954 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -16,12 +16,10 @@ #******************************************************************************* # temporary redef, to ensure wider compliance of the SDK with pre-1.6 apps -ifeq ($(DISABLE_UI),0) - ifeq ($(USE_NBGL),0) - SDK_SOURCE_PATH += lib_bagl lib_ux - else - SDK_SOURCE_PATH += lib_nbgl lib_ux_stax - endif +ifeq ($(USE_NBGL),0) + SDK_SOURCE_PATH += lib_bagl lib_ux +else + SDK_SOURCE_PATH += lib_nbgl lib_ux_stax endif define uniq =