Skip to content

Commit

Permalink
Merge pull request #20 from LedgerHQ/stax-develop
Browse files Browse the repository at this point in the history
Stax develop
  • Loading branch information
apaillier-ledger authored May 17, 2023
2 parents 723670e + 7573a95 commit d51ed69
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
name: "nanox"
- sdk: "$NANOSP_SDK"
name: "nanosp"
- sdk: "$STAX_SDK"
name: "stax"

runs-on: ubuntu-latest
container:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ debug/
dep/
obj/
tests/elfs/plugin_nano*.elf
build/

# Editors
.idea/
Expand Down
31 changes: 18 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -115,29 +126,23 @@ 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)
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)
Expand Down
2 changes: 1 addition & 1 deletion ethereum-plugin-sdk
Binary file removed glyphs/icon_back.gif
Binary file not shown.
Binary file removed glyphs/icon_back_x.gif
Binary file not shown.
Binary file removed glyphs/icon_certificate.gif
Binary file not shown.
Binary file removed glyphs/icon_crossmark.gif
Binary file not shown.
Binary file removed glyphs/icon_dashboard.gif
Binary file not shown.
Binary file removed glyphs/icon_dashboard_x.gif
Binary file not shown.
Binary file removed glyphs/icon_down.gif
Binary file not shown.
Binary file removed glyphs/icon_eye.gif
Binary file not shown.
Binary file removed glyphs/icon_left.gif
Binary file not shown.
Binary file removed glyphs/icon_right.gif
Binary file not shown.
Binary file removed glyphs/icon_toggle_reset.gif
Binary file not shown.
Binary file removed glyphs/icon_toggle_set.gif
Binary file not shown.
Binary file removed glyphs/icon_up.gif
Binary file not shown.
Binary file removed glyphs/icon_validate_14.gif
Binary file not shown.
Binary file removed glyphs/icon_warning.gif
Binary file not shown.
Binary file added glyphs/stax_paraswap_64px.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/stax_app_paraswap.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit d51ed69

Please sign in to comment.