diff --git a/Makefile b/Makefile index 36f6bcbd..a9e601e9 100644 --- a/Makefile +++ b/Makefile @@ -21,147 +21,49 @@ endif include $(BOLOS_SDK)/Makefile.defines -APP_LOAD_PARAMS = --curve ed25519 ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) -APP_LOAD_PARAMS += --appFlags 0x200 +CUSTOM_APP_FLAGS = 0x200 else -APP_LOAD_PARAMS += --appFlags 0x000 +CUSTOM_APP_FLAGS = 0x000 endif -APP_LOAD_PARAMS += --path "44'/134'" -APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS) - -APPVERSION_M = 1 -APPVERSION_N = 0 -APPVERSION_P = 0 -APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APPNAME = "Lisk" -ifeq ($(TARGET_NAME), TARGET_NANOS) -ICONNAME=icons/nanos_app_lisk.gif -else ifeq ($(TARGET_NAME), TARGET_STAX) -ICONNAME=icons/stax_app_lisk.gif -DEFINES += ICONGLYPH=C_stax_lisk_64px -DEFINES += ICONBITMAP=C_stax_lisk_64px_bitmap -GLYPH_FILES += $(ICONNAME) -else -ICONNAME=icons/nanox_app_lisk.gif -endif - -all: default - -# Platform -DEFINES += OS_IO_SEPROXYHAL -DEFINES += HAVE_SPRINTF -DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M) LEDGER_MINOR_VERSION=$(APPVERSION_N) LEDGER_PATCH_VERSION=$(APPVERSION_P) -DEFINES += IO_HID_EP_LENGTH=64 - -DEFINES += UNUSED\(x\)=\(void\)x -DEFINES += APPVERSION=\"$(APPVERSION)\" -CFLAGS += -DAPPNAME=\"$(APPNAME)\" - -ifneq (,$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) -DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 -DEFINES += HAVE_BLE_APDU -endif - - -ifeq ($(TARGET_NAME),TARGET_NANOS) -DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128 -else -DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 -endif - -ifneq ($(TARGET_NAME),TARGET_STAX) -DEFINES += HAVE_BAGL -ifneq ($(TARGET_NAME),TARGET_NANOS) -DEFINES += HAVE_GLO096 -DEFINES += HAVE_BAGL BAGL_WIDTH=128 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 -DEFINES += HAVE_UX_FLOW -endif -endif - -SPECULOS:= 0 -ifneq ($(SPECULOS), 0) -DEFINES += SPECULOS -DEBUG := 10 -endif - -ifneq ($(DEBUG),0) - DEFINES += HAVE_STACK_OVERFLOW_CHECK - SDK_SOURCE_PATH += lib_stusb lib_stusb_impl - DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU - - ifeq ($(DEBUG),10) - $(warning Using semihosted PRINTF. Only run with speculos!) - CFLAGS += -include src/dbg/debug.h - DEFINES += HAVE_PRINTF PRINTF=semihosted_printf - else - ifeq ($(TARGET_NAME),TARGET_NANOX) - DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf - else - DEFINES += HAVE_PRINTF PRINTF=screen_printf - endif - - endif -else - DEFINES += PRINTF\(...\)= -endif - -# Compiler -ifneq ($(BOLOS_ENV),) -$(info BOLOS_ENV=$(BOLOS_ENV)) -CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/ -GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/ -else -$(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH) -endif -ifeq ($(CLANGPATH),) -$(info CLANGPATH is not set: clang will be used from PATH) -endif -ifeq ($(GCCPATH),) -$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH) -endif - -CC := $(CLANGPATH)clang +# Application version +APPVERSION_M = 1 +APPVERSION_N = 0 +APPVERSION_P = 0 -AS := $(GCCPATH)arm-none-eabi-gcc +APPVERSION ?= "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" -LD := $(GCCPATH)arm-none-eabi-gcc -LDLIBS += -lm -lgcc -lc +# Application source files +APP_SOURCE_PATH += src ethereum-plugin-sdk -# Import rules to compile glyphs(/pone) -include $(BOLOS_SDK)/Makefile.glyphs +NORMAL_NAME ?= $(shell echo -n "$(APPNAME)" | tr " ." "_" | tr "[:upper:]" "[:lower:]") +ICON_NANOS = icons/nanos_app_$(NORMAL_NAME).gif +ICON_NANOX = icons/nanox_app_$(NORMAL_NAME).gif +ICON_NANOSP = $(ICON_NANOX) +ICON_STAX = icons/stax_app_$(NORMAL_NAME).gif -APP_SOURCE_PATH += src ethereum-plugin-sdk -ifneq ($(TARGET_NAME), TARGET_STAX) -SDK_SOURCE_PATH += lib_ux +ifeq ($(TARGET_NAME),TARGET_STAX) + DEFINES += ICONGLYPH=C_stax_$(NORMAL_NAME)_64px + DEFINES += ICONBITMAP=C_stax_$(NORMAL_NAME)_64px_bitmap endif -ifneq (,$(findstring HAVE_BLE,$(DEFINES))) -SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl -endif - -# Initialize plugin SDK submodule if needed -ifneq ($(shell git submodule status | grep '^[-+]'),) -$(info INFO: Need to reinitialize git submodules) -$(shell git submodule update --init) -endif - -load: all - python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) -delete: - python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) +CURVE_APP_LOAD_PARAMS = ed25519 +PATH_APP_LOAD_PARAMS = "44'/134'" -# Import generic rules from the sdk -include $(BOLOS_SDK)/Makefile.rules +VARIANT_PARAM = COIN +VARIANT_VALUES = LSK +HAVE_APPLICATION_FLAG_LIBRARY = 0 -dep/%.d: %.c Makefile +DISABLE_STANDARD_APP_FILES = 1 +DISABLE_STANDARD_SNPRINTF = 1 +DISABLE_STANDARD_USB = 1 +DISABLE_STANDARD_WEBUSB = 1 +DISABLE_STANDARD_BAGL_UX_FLOW = 1 +DISABLE_DEBUG_LEDGER_ASSERT = 1 +DISABLE_DEBUG_THROW = 1 -listvariants: - @echo VARIANTS COIN LSK +include $(BOLOS_SDK)/Makefile.standard_app