diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index cabc149..1b82da9 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -21,6 +21,8 @@ jobs: name: "nanox" - sdk: "$NANOSP_SDK" name: "nanosp" + - sdk: "$STAX_SDK" + name: "stax" runs-on: ubuntu-latest container: diff --git a/.gitignore b/.gitignore index 5cbbd62..f02a5ce 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ debug/ dep/ obj/ tests/elfs/plugin_nano*.elf +build/ # Editors .idea/ diff --git a/Makefile b/Makefile index a413471..acf3820 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,11 @@ APPNAME = "Paraswap" #prepare hsm generation ifeq ($(TARGET_NAME), TARGET_NANOS) ICONNAME=icons/nanos_app_paraswap.gif +else ifeq ($(TARGET_NAME), TARGET_STAX) +ICONNAME=icons/stax_app_paraswap.gif +DEFINES += ICONGLYPH=C_stax_paraswap_64px +DEFINES += ICONBITMAP=C_stax_paraswap_64px_bitmap +GLYPH_FILES += $(ICONNAME) else ICONNAME=icons/nanox_app_paraswap.gif endif @@ -48,14 +53,15 @@ all: default ############ DEFINES += OS_IO_SEPROXYHAL -DEFINES += HAVE_BAGL HAVE_SPRINTF +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)\" -ifeq ($(TARGET_NAME),TARGET_NANOX) +ifneq (,$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE endif @@ -64,6 +70,11 @@ 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 # long label truncation feature @@ -72,12 +83,12 @@ DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX DEFINES += HAVE_UX_FLOW endif +endif # Enabling debug PRINTF -DEBUG:= 0 ifneq ($(DEBUG),0) DEFINES += HAVE_STACK_OVERFLOW_CHECK - SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_u2f + 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) @@ -115,13 +126,9 @@ endif CC := $(CLANGPATH)clang -#CFLAGS += -O0 -CFLAGS += -O3 -Os - AS := $(GCCPATH)arm-none-eabi-gcc LD := $(GCCPATH)arm-none-eabi-gcc -LDFLAGS += -O3 -Os LDLIBS += -lm -lgcc -lc # import rules to compile glyphs(/pone) @@ -129,15 +136,13 @@ include $(BOLOS_SDK)/Makefile.glyphs ### variables processed by the common makefile.rules of the SDK to grab source files and include dirs APP_SOURCE_PATH += src ethereum-plugin-sdk +ifneq ($(TARGET_NAME), TARGET_STAX) SDK_SOURCE_PATH += lib_ux -ifeq ($(TARGET_NAME),TARGET_NANOX) +endif +ifneq (,$(findstring HAVE_BLE,$(DEFINES))) SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl endif - -# remove UX warnings from SDK even though the plugin doesn't use it -DEFINES += HAVE_UX_FLOW - ### initialize plugin SDK submodule if needed ifneq ($(shell git submodule status | grep '^[-+]'),) $(info INFO: Need to reinitialize git submodules) diff --git a/ethereum-plugin-sdk b/ethereum-plugin-sdk index a4b971f..b9777e7 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit a4b971f67980694d8c3862e793859209bc525545 +Subproject commit b9777e7a81a9c33b3f8997ffa23396fa2b3f861d diff --git a/glyphs/icon_back.gif b/glyphs/icon_back.gif deleted file mode 100644 index a2a7e6d..0000000 Binary files a/glyphs/icon_back.gif and /dev/null differ diff --git a/glyphs/icon_back_x.gif b/glyphs/icon_back_x.gif deleted file mode 100644 index ff04361..0000000 Binary files a/glyphs/icon_back_x.gif and /dev/null differ diff --git a/glyphs/icon_certificate.gif b/glyphs/icon_certificate.gif deleted file mode 100644 index 89b529f..0000000 Binary files a/glyphs/icon_certificate.gif and /dev/null differ diff --git a/glyphs/icon_crossmark.gif b/glyphs/icon_crossmark.gif deleted file mode 100644 index 2dcf9d9..0000000 Binary files a/glyphs/icon_crossmark.gif and /dev/null differ diff --git a/glyphs/icon_dashboard.gif b/glyphs/icon_dashboard.gif deleted file mode 100644 index 5c30551..0000000 Binary files a/glyphs/icon_dashboard.gif and /dev/null differ diff --git a/glyphs/icon_dashboard_x.gif b/glyphs/icon_dashboard_x.gif deleted file mode 100644 index 33d9b0a..0000000 Binary files a/glyphs/icon_dashboard_x.gif and /dev/null differ diff --git a/glyphs/icon_down.gif b/glyphs/icon_down.gif deleted file mode 100644 index 4f4e39e..0000000 Binary files a/glyphs/icon_down.gif and /dev/null differ diff --git a/glyphs/icon_eye.gif b/glyphs/icon_eye.gif deleted file mode 100644 index df4bb82..0000000 Binary files a/glyphs/icon_eye.gif and /dev/null differ diff --git a/glyphs/icon_left.gif b/glyphs/icon_left.gif deleted file mode 100644 index 524226b..0000000 Binary files a/glyphs/icon_left.gif and /dev/null differ diff --git a/glyphs/icon_right.gif b/glyphs/icon_right.gif deleted file mode 100644 index 15ff3cf..0000000 Binary files a/glyphs/icon_right.gif and /dev/null differ diff --git a/glyphs/icon_toggle_reset.gif b/glyphs/icon_toggle_reset.gif deleted file mode 100644 index 450bc86..0000000 Binary files a/glyphs/icon_toggle_reset.gif and /dev/null differ diff --git a/glyphs/icon_toggle_set.gif b/glyphs/icon_toggle_set.gif deleted file mode 100644 index 571264c..0000000 Binary files a/glyphs/icon_toggle_set.gif and /dev/null differ diff --git a/glyphs/icon_up.gif b/glyphs/icon_up.gif deleted file mode 100644 index 4e13c06..0000000 Binary files a/glyphs/icon_up.gif and /dev/null differ diff --git a/glyphs/icon_validate_14.gif b/glyphs/icon_validate_14.gif deleted file mode 100644 index ccb5cab..0000000 Binary files a/glyphs/icon_validate_14.gif and /dev/null differ diff --git a/glyphs/icon_warning.gif b/glyphs/icon_warning.gif deleted file mode 100644 index 1393e05..0000000 Binary files a/glyphs/icon_warning.gif and /dev/null differ diff --git a/glyphs/stax_paraswap_64px.gif b/glyphs/stax_paraswap_64px.gif new file mode 100644 index 0000000..da9f824 Binary files /dev/null and b/glyphs/stax_paraswap_64px.gif differ diff --git a/icons/stax_app_paraswap.gif b/icons/stax_app_paraswap.gif new file mode 100644 index 0000000..592f209 Binary files /dev/null and b/icons/stax_app_paraswap.gif differ diff --git a/src/main.c b/src/main.c index e298ba7..1128167 100644 --- a/src/main.c +++ b/src/main.c @@ -213,10 +213,27 @@ void handle_query_ui_exception(unsigned int *args) { } void call_app_ethereum() { - unsigned int libcall_params[3]; + unsigned int libcall_params[5]; + libcall_params[0] = (unsigned int) "Ethereum"; libcall_params[1] = 0x100; libcall_params[2] = RUN_APPLICATION; + libcall_params[3] = (unsigned int) NULL; +#ifdef HAVE_NBGL + caller_app_t capp; + const char name[] = APPNAME; + nbgl_icon_details_t icon_details; + uint8_t bitmap[sizeof(ICONBITMAP)]; + + memcpy(&icon_details, &ICONGLYPH, sizeof(ICONGLYPH)); + memcpy(&bitmap, &ICONBITMAP, sizeof(bitmap)); + icon_details.bitmap = (const uint8_t *) bitmap; + capp.name = (const char *) name; + capp.icon = &icon_details; + libcall_params[4] = (unsigned int) &capp; +#else + libcall_params[4] = (unsigned int) NULL; +#endif os_lib_call((unsigned int *) &libcall_params); }