Skip to content

Commit

Permalink
Merge pull request #527 from LedgerHQ/xch/makefile-defines
Browse files Browse the repository at this point in the history
Makefile: Refactor UI handling
  • Loading branch information
xchapron-ledger authored Feb 7, 2024
2 parents 5849a44 + 2b4d131 commit 4ad2791
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
54 changes: 26 additions & 28 deletions Makefile.defines
Original file line number Diff line number Diff line change
Expand Up @@ -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' ')
Expand Down Expand Up @@ -169,9 +164,9 @@ 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
DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_24PX
DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_24PX
DEFINES += HAVE_BAGL_FONT_INTER_MEDIUM_32PX
Expand All @@ -182,32 +177,37 @@ 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

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2))
# Screen is directly connected to the SE
Expand All @@ -217,8 +217,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
Expand Down
2 changes: 1 addition & 1 deletion Makefile.glyphs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
#*******************************************************************************

# temporary redef, to ensure wider compliance of the SDK with pre-1.6 apps
ifeq ($(DISABLE_UI),0)
ifndef USE_NBGL
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 =
Expand Down
2 changes: 1 addition & 1 deletion Makefile.standard_app
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ad2791

Please sign in to comment.