diff --git a/app/Makefile b/app/Makefile index 224bba19..9841b856 100755 --- a/app/Makefile +++ b/app/Makefile @@ -22,14 +22,9 @@ endif MY_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.installer_script - -include $(BOLOS_SDK)/Makefile.defines - # Set the default value for PRODUCTION_BUILD to 1 if not already defined PRODUCTION_BUILD ?= 1 -$(info ************ TARGET_NAME = [$(TARGET_NAME)]) # Display whether this is a production build or for internal use ifeq ($(PRODUCTION_BUILD), 1) $(info ************ PRODUCTION_BUILD = [PRODUCTION BUILD]) @@ -39,19 +34,22 @@ endif # Add the PRODUCTION_BUILD definition to the compiler flags DEFINES += PRODUCTION_BUILD=$(PRODUCTION_BUILD) + include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.app_testing ifndef COIN COIN=NAM endif +VARIANT_PARAM=COIN +VARIANT_VALUES=$(COIN) + include $(CURDIR)/Makefile.version $(info COIN = [$(COIN)]) ifeq ($(COIN),NAM) # Main app configuration -DEFINES += APP_STANDARD APPNAME = "Namada" APPPATH = "44'/877'" --path "44'/1'" @@ -66,33 +64,44 @@ endif APP_LOAD_PARAMS = --curve ed25519 $(COMMON_LOAD_PARAMS) --path $(APPPATH) -include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices +# Enable QR code display for all devices +ENABLE_NBGL_QRCODE ?= 1 -$(info TARGET_NAME = [$(TARGET_NAME)]) -$(info ICONNAME = [$(ICONNAME)]) +RUST_TARGET:=thumbv6m-none-eabi -ifndef ICONNAME -$(error ICONNAME is not set) -endif +$(info ************ RUST_TARGET = [$(RUST_TARGET)]) + +include $(BOLOS_SDK)/Makefile.target + +include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices + +include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform # Compile MASP mode for all devices excetpt Nano S, ifneq ($(TARGET_NAME),TARGET_NANOS) DEFINES += COMPILE_MASP endif -include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform # Add SDK BLAKE2b DEFINES += HAVE_HASH HAVE_BLAKE2 INCLUDES_PATH += $(BOLOS_SDK)/lib_cxng/src - # Building Rust LDFLAGS += -z muldefs LDLIBS += -L$(MY_DIR)rust/target/$(RUST_TARGET)/release -lrslib - APP_SOURCE_PATH += $(CURDIR)/rust/include -APP_CUSTOM_LINK_DEPENDENCIES = rust -RUST_TARGET:=thumbv6m-none-eabi + +include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.installer_script + +$(info TARGET_NAME = [$(TARGET_NAME)]) +$(info ICONNAME = [$(ICONNAME)]) + +ifndef ICONNAME +$(error ICONNAME is not set) +endif + +# make rust a prerequisite for all object files +$(OBJECT_FILES): | rust .PHONY: rust rust: @@ -104,17 +113,9 @@ rust_clean: clean: rust_clean -include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.side_loading - -# Import generic rules from the SDK -include $(BOLOS_SDK)/Makefile.rules - #add dependency on custom makefile filename dep/%.d: %.c Makefile -listvariants: - @echo VARIANTS COIN NAM - .PHONY: version version: @echo "v$(APPVERSION)" > app.version diff --git a/app/src/apdu_handler.c b/app/src/apdu_handler.c index e967a54d..f78a737a 100644 --- a/app/src/apdu_handler.c +++ b/app/src/apdu_handler.c @@ -239,14 +239,14 @@ __Z_INLINE void handle_getversion(__Z_UNUSED volatile uint32_t *flags, volatile G_io_apdu_buffer[0] = 0x01; #endif - G_io_apdu_buffer[1] = (LEDGER_MAJOR_VERSION >> 8) & 0xFF; - G_io_apdu_buffer[2] = (LEDGER_MAJOR_VERSION >> 0) & 0xFF; + G_io_apdu_buffer[1] = (MAJOR_VERSION >> 8) & 0xFF; + G_io_apdu_buffer[2] = (MAJOR_VERSION >> 0) & 0xFF; - G_io_apdu_buffer[3] = (LEDGER_MINOR_VERSION >> 8) & 0xFF; - G_io_apdu_buffer[4] = (LEDGER_MINOR_VERSION >> 0) & 0xFF; + G_io_apdu_buffer[3] = (MINOR_VERSION >> 8) & 0xFF; + G_io_apdu_buffer[4] = (MINOR_VERSION >> 0) & 0xFF; - G_io_apdu_buffer[5] = (LEDGER_PATCH_VERSION >> 8) & 0xFF; - G_io_apdu_buffer[6] = (LEDGER_PATCH_VERSION >> 0) & 0xFF; + G_io_apdu_buffer[5] = (PATCH_VERSION >> 8) & 0xFF; + G_io_apdu_buffer[6] = (PATCH_VERSION >> 0) & 0xFF; // SDK won't reply if device is blocked ---> Always false G_io_apdu_buffer[7] = 0; diff --git a/app/src/common/tx.c b/app/src/common/tx.c index 58484a21..4431b6f0 100644 --- a/app/src/common/tx.c +++ b/app/src/common/tx.c @@ -17,7 +17,7 @@ #include "tx.h" #include "apdu_codes.h" #include "buffering.h" -#include "parser.h" +#include "common/parser.h" #include #include "zxmacros.h" @@ -25,7 +25,7 @@ #define RAM_BUFFER_SIZE 8192 #define FLASH_BUFFER_SIZE 16384 #elif defined(TARGET_NANOS) -#define RAM_BUFFER_SIZE 256 +#define RAM_BUFFER_SIZE 0 #define FLASH_BUFFER_SIZE 8192 #endif diff --git a/app/src/parser.c b/app/src/parser.c index 310cd649..f850d6b2 100644 --- a/app/src/parser.c +++ b/app/src/parser.c @@ -21,7 +21,7 @@ #include "parser_common.h" #include "parser_impl.h" -#include "parser.h" +#include "common/parser.h" #include "crypto.h" #include "crypto_helper.h" diff --git a/fuzz/parser_parse.cpp b/fuzz/parser_parse.cpp index 481f52d6..9ff29b8f 100644 --- a/fuzz/parser_parse.cpp +++ b/fuzz/parser_parse.cpp @@ -2,7 +2,7 @@ #include #include -#include "parser.h" +#include "common/parser.h" #include "zxformat.h" #ifdef NDEBUG diff --git a/tests/common.cpp b/tests/common.cpp index e44687e9..9c09c021 100644 --- a/tests/common.cpp +++ b/tests/common.cpp @@ -16,7 +16,7 @@ #include "gmock/gmock.h" #include "parser_impl.h" -#include +#include #include #include #include @@ -26,7 +26,6 @@ #include #include #include -#include "parser.h" std::vector dumpUI(parser_context_t *ctx, uint16_t maxKeyLen,