Skip to content

Commit

Permalink
Merge pull request 'Initiate Europa target and adapt NBGL (size, font…
Browse files Browse the repository at this point in the history
…s)' (#1) from initiate-nbgl-europa into europa_target

Reviewed-on: https://git.donjon.ledger.fr/gitea/ledger-core/private-sdk/pulls/1
  • Loading branch information
nroggeman-ledger committed Jan 16, 2024
2 parents f6bdb7d + 8e725d5 commit 252458c
Show file tree
Hide file tree
Showing 21 changed files with 476 additions and 48 deletions.
8 changes: 2 additions & 6 deletions Makefile.app_params
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@

# Command to print ICONNAME hexadecimal bitmap on stdout according to the
# hardware target.
ifneq ($(TARGET),nanos)
#inverse B&W for non Stax
ifneq ($(TARGET_NAME),TARGET_STAX)
#inverse B&W for Nano
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2))
ICONHEX_CMD=python3 $(BOLOS_SDK)/lib_nbgl/tools/icon2glyph.py --reverse --hexbitmaponly $(ICONNAME)
else
ICONHEX_CMD=python3 $(BOLOS_SDK)/lib_nbgl/tools/icon2glyph.py --hexbitmaponly $(ICONNAME)
endif
else
ICONHEX_CMD=python3 $(BOLOS_SDK)/icon3.py --hexbitmaponly $(ICONNAME)
endif


#########################################
Expand Down
20 changes: 14 additions & 6 deletions Makefile.defines
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# TARGET should be set as an environment variable otherwise it will be read from a `.target`
# file in the SDK root repository
TARGETS := nanos nanox nanos2 stax
TARGETS := nanos nanox nanos2 stax europa
ifeq ($(TARGET),)
ifeq ("$(wildcard $(BOLOS_SDK)/.target)","")
$(error No TARGET specified and no .target file in SDK repository $(BOLOS_SDK))
Expand All @@ -31,7 +31,7 @@ $(error TARGET not set to a valid value (possible values: $(TARGETS)))
endif

# for Stax, NBGL must be used
ifeq ($(TARGET),stax)
ifneq (,$(filter $(TARGET),stax europa))
USE_NBGL ?= 1
endif

Expand Down Expand Up @@ -181,7 +181,17 @@ DEFINES += HAVE_PIEZO_SOUND
DEFINES += HAVE_SE_TOUCH
DEFINES += NBGL_PAGE
DEFINES += NBGL_USE_CASE
#DEFINES += HAVE_DISPLAY_FAST_MODE
else
ifeq ($(TARGET_NAME),TARGET_EUROPA)
DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_28PX
DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_28PX
DEFINES += HAVE_BAGL_FONT_INTER_MEDIUM_36PX
DEFINES += HAVE_INAPP_BLE_PAIRING
DEFINES += HAVE_NBGL
DEFINES += HAVE_PIEZO_SOUND
DEFINES += HAVE_SE_TOUCH
DEFINES += NBGL_PAGE
DEFINES += NBGL_USE_CASE
else
DEFINES += BAGL_WIDTH=128
ifdef USE_NBGL
Expand All @@ -191,9 +201,6 @@ DEFINES += NBGL_USE_CASE
else
DEFINES += HAVE_BAGL
endif
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
Expand All @@ -206,6 +213,7 @@ DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
endif
endif
endif
endif

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2))
# Screen is directly connected to the SE
Expand Down
6 changes: 3 additions & 3 deletions Makefile.glyphs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ ifdef USE_NBGL
# NBGL glyphs files and generation script
#
# search icons (glyphs) in lib_nbgl/glyphs(_nano) folder of the SDK
ifeq ($(TARGET_NAME),TARGET_STAX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs/))))
GLYPH_OPT :=
else # ($(TARGET_NAME),TARGET_STAX)
else # ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs_nano/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs_nano/))))
#inverse B&W for non Stax
GLYPH_OPT := --reverse
endif # ($(TARGET_NAME),TARGET_STAX)
endif # ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
ifneq (,$(wildcard $(ICONNAME)))
# Do not try to generate app icon glyph, if image does not exist
Expand Down
10 changes: 5 additions & 5 deletions Makefile.standard_app
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# BLUETOOTH #
#####################################################################
ifeq ($(ENABLE_BLUETOOTH), 1)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX))
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX TARGET_EUROPA))
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 HAVE_BLE_APDU
DEFINES += BLE_SEGMENT_SIZE=32
Expand Down Expand Up @@ -128,20 +128,20 @@ endif
# NBGL #
#####################################################################
ifeq ($(ENABLE_NBGL_QRCODE), 1)
ifeq ($(TARGET_NAME), TARGET_STAX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
DEFINES += NBGL_QRCODE
SDK_SOURCE_PATH += qrcode
endif
endif

ifeq ($(ENABLE_NBGL_KEYBOARD), 1)
ifeq ($(TARGET_NAME), TARGET_STAX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
DEFINES += NBGL_KEYBOARD
endif
endif

ifeq ($(ENABLE_NBGL_KEYPAD), 1)
ifeq ($(TARGET_NAME), TARGET_STAX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
DEFINES += NBGL_KEYPAD
endif
endif
Expand Down Expand Up @@ -200,7 +200,7 @@ endif
ifeq ($(TARGET_NAME), TARGET_NANOS2)
ICONNAME ?= $(ICON_NANOSP)
endif
ifeq ($(TARGET_NAME),TARGET_STAX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
ICONNAME ?= $(ICON_STAX)
endif

Expand Down
2 changes: 2 additions & 0 deletions include/cx_trampoline.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
#define CX_TRAMPOLINE_ADDR 0x00810001
#elif defined(TARGET_STAX)
#define CX_TRAMPOLINE_ADDR 0x00818001
#elif defined(TARGET_EUROPA)
#define CX_TRAMPOLINE_ADDR 0x00818001
#endif
8 changes: 4 additions & 4 deletions lib_blewbxx_impl/src/ledger_ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void check_transfer_mode(uint8_t enable);

/* Private variables ---------------------------------------------------------*/
// clang-format off
#ifdef TARGET_STAX
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
const uint8_t service_uuid[16] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13,};
const uint8_t charUuidTX[16] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13,};
const uint8_t charUuidRX[16] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x60,0x97,0x2C,0x00,0x34,0xD6,0x13,};
Expand Down Expand Up @@ -451,7 +451,7 @@ static void init_mngr(uint16_t opcode, const uint8_t *buffer, uint16_t length)
case BLE_INIT_STEP_SET_TX_POWER_LEVEL:
ledger_ble_data.hci_cmd_opcode = 0xfc0f;
aci_hal_set_tx_power_level(1, // High power (ignored)
#ifdef TARGET_STAX
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
0x19); // 0 dBm
#else // !TARGET_STAX
0x07); // -14.1 dBm
Expand Down Expand Up @@ -771,7 +771,7 @@ static void ask_user_pairing_numeric_comparison(uint32_t code)
ledger_ble_data.pairing_in_progress = 1;
ux_params.u.pairing_request.pairing_info_len = 6;
SPRINTF(ux_params.u.pairing_request.pairing_info, "%06d", (unsigned int) code);
#ifdef TARGET_STAX
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
G_io_asynch_ux_callback.asynchmodal_end_callback = NULL;
#else // !TARGET_STAX
G_io_asynch_ux_callback.asynchmodal_end_callback = rsp_user_pairing_numeric_comparison;
Expand Down Expand Up @@ -809,7 +809,7 @@ static void ask_user_pairing_passkey(void)
ledger_ble_data.pairing_code = cx_rng_u32_range_func(0, 1000000, cx_rng_u32);
ux_params.u.pairing_request.pairing_info_len = 6;
SPRINTF(ux_params.u.pairing_request.pairing_info, "%06d", ledger_ble_data.pairing_code);
#ifdef TARGET_STAX
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
G_io_asynch_ux_callback.asynchmodal_end_callback = NULL;
#else // !TARGET_STAX
G_io_asynch_ux_callback.asynchmodal_end_callback = rsp_user_pairing_passkey;
Expand Down
15 changes: 12 additions & 3 deletions lib_nbgl/include/nbgl_font_rom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@
* limitations under the License.
********************************************************************************/

#ifdef HAVE_SE_TOUCH
#ifdef SCREEN_SIZE_WALLET
#ifdef TARGET_STAX
#include "nbgl_font_inter_regular_24.inc"
#include "nbgl_font_inter_semibold_24.inc"
#include "nbgl_font_inter_medium_32.inc"
#include "nbgl_font_inter_regular_24_1bpp.inc"
#include "nbgl_font_inter_semibold_24_1bpp.inc"
#include "nbgl_font_inter_medium_32_1bpp.inc"
#else // HAVE_SE_TOUCH
#else // TARGET_STAX
#include "nbgl_font_inter_regular_28.inc"
#include "nbgl_font_inter_semibold_28.inc"
#include "nbgl_font_inter_medium_36.inc"
#include "nbgl_font_inter_regular_28_1bpp.inc"
#include "nbgl_font_inter_semibold_28_1bpp.inc"
#include "nbgl_font_inter_medium_36_1bpp.inc"
#endif // TARGET_STAX
#else // SCREEN_SIZE_WALLET
#include "nbgl_font_open_sans_extrabold_11.inc"
#include "nbgl_font_open_sans_regular_11.inc"
#include "nbgl_font_open_sans_light_16.inc"
#endif // HAVE_SE_TOUCH
#endif // SCREEN_SIZE_WALLET
#if (defined(HAVE_BOLOS) && !defined(BOLOS_OS_UPGRADER_APP))
#if !defined(HAVE_LANGUAGE_PACK)
#if (OS_LANGUAGE==LANG_ENGLISH)
Expand Down
13 changes: 13 additions & 0 deletions lib_nbgl/include/nbgl_fonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,26 @@ extern "C" {
* @brief fonts nicknames to be used for various wallet size targets (non-Nano)
*
*/
#ifdef TARGET_STAX
#define SMALL_REGULAR_FONT BAGL_FONT_INTER_REGULAR_24px
#define SMALL_BOLD_FONT BAGL_FONT_INTER_SEMIBOLD_24px
#define LARGE_MEDIUM_FONT BAGL_FONT_INTER_MEDIUM_32px
#define SMALL_REGULAR_1BPP_FONT BAGL_FONT_INTER_REGULAR_24px_1bpp
#define SMALL_BOLD_1BPP_FONT BAGL_FONT_INTER_SEMIBOLD_24px_1bpp
#define LARGE_MEDIUM_1BPP_FONT BAGL_FONT_INTER_MEDIUM_32px_1bpp

#else // TARGET_STAX

#ifdef TARGET_EUROPA
#define SMALL_REGULAR_FONT BAGL_FONT_INTER_REGULAR_28px
#define SMALL_BOLD_FONT BAGL_FONT_INTER_SEMIBOLD_28px
#define LARGE_MEDIUM_FONT BAGL_FONT_INTER_MEDIUM_36px
#define SMALL_REGULAR_1BPP_FONT BAGL_FONT_INTER_REGULAR_28px_1bpp
#define SMALL_BOLD_1BPP_FONT BAGL_FONT_INTER_SEMIBOLD_28px_1bpp
#define LARGE_MEDIUM_1BPP_FONT BAGL_FONT_INTER_MEDIUM_36px_1bpp
#endif
#endif // TARGET_STAX

/**********************
* TYPEDEFS
**********************/
Expand Down
2 changes: 2 additions & 0 deletions lib_nbgl/include/nbgl_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout,
bool enableDigits);
int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive);
int nbgl_layoutAddSwipe(nbgl_layout_t *layout, uint8_t token, uint16_t swipesMask);

#else // HAVE_SE_TOUCH
/* layout objects for pages with keypad (nanos) */
int nbgl_layoutAddKeypad(nbgl_layout_t *layout,
Expand Down
20 changes: 16 additions & 4 deletions lib_nbgl/include/nbgl_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ extern "C" {

// for Keypad
#ifdef HAVE_SE_TOUCH
#if (SCREEN_HEIGHT == 600)
#define KEYPAD_KEY_HEIGHT 88
#else
#define KEYPAD_KEY_HEIGHT 104
#endif
#else // HAVE_SE_TOUCH
#define KEYPAD_WIDTH 114
#define KEYPAD_HEIGHT 18
Expand Down Expand Up @@ -168,9 +172,17 @@ typedef enum {
///< been pressed.
TOUCH_RELEASED, ///< corresponding to an object that was touched and where the finger has been
///< released.
VALUE_CHANGED ///< corresponding to a change of state of the object (indirect event)
VALUE_CHANGED, ///< corresponding to a change of state of the object (indirect event)
SWIPED_UP,
SWIPED_DOWN,
SWIPED_RIGHT,
SWIPED_LEFT,
NB_TOUCH_TYPES
} nbgl_touchType_t;

#define SWIPE_MASK \
((1 << SWIPED_UP) | (1 << SWIPED_DOWN) | (1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT))

/**
* @brief The different pressed buttons
*
Expand Down Expand Up @@ -239,9 +251,9 @@ typedef struct PACKED__ nbgl_obj_s {
int16_t alignmentMarginX; ///< horizontal margin when aligning
int16_t alignmentMarginY; ///< vertical margin when aligning
nbgl_obj_type_t type; ///< type of the graphical object, must be explicitly set
uint8_t touchMask; ///< bit mask to tell engine which touch events are handled by this object
uint8_t touchId; ///< a unique identifier (by screen) to be used by external test environment
///< (TTYT or Screenshots)
uint16_t touchMask; ///< bit mask to tell engine which touch events are handled by this object
uint8_t touchId; ///< a unique identifier (by screen) to be used by external test environment
///< (TTYT or Screenshots)
} nbgl_obj_t;

/**
Expand Down
1 change: 1 addition & 0 deletions lib_nbgl/include/nbgl_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ void nbgl_screen_config_fast_mode(uint8_t fast_mode_setting);
#endif // HAVE_CONFIGURABLE_DISPLAY_FAST_MODE

void nbgl_screenRedraw(void);
nbgl_obj_t *nbgl_screenGetAt(uint8_t screenIndex);
nbgl_obj_t *nbgl_screenGetTop(void);
uint8_t nbgl_screenGetCurrentStackSize(void);
bool nbgl_screenContainsObj(nbgl_obj_t *obj);
Expand Down
4 changes: 4 additions & 0 deletions lib_nbgl/include/nbgl_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ extern "C" {
#ifdef SCREEN_SIZE_WALLET
#ifdef TARGET_STAX
#define SCREEN_WIDTH 400
#else // TARGET_STAX
#define SCREEN_WIDTH 480
#endif // TARGET_STAX
#else // SCREEN_SIZE_WALLET
#define SCREEN_WIDTH 128
Expand All @@ -39,6 +41,8 @@ extern "C" {
#ifdef SCREEN_SIZE_WALLET
#ifdef TARGET_STAX
#define SCREEN_HEIGHT 672
#else // TARGET_STAX
#define SCREEN_HEIGHT 600
#endif // TARGET_STAX
#else // SCREEN_SIZE_WALLET
#define SCREEN_HEIGHT 64
Expand Down
7 changes: 7 additions & 0 deletions lib_nbgl/src/nbgl_fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ extern const LANGUAGE_PACK *language_pack;
#include "nbgl_font_inter_regular_24_1bpp.inc"
#include "nbgl_font_inter_semibold_24_1bpp.inc"
#include "nbgl_font_inter_medium_32_1bpp.inc"
#else // TARGET_STAX
#include "nbgl_font_inter_regular_28.inc"
#include "nbgl_font_inter_semibold_28.inc"
#include "nbgl_font_inter_medium_36.inc"
#include "nbgl_font_inter_regular_28_1bpp.inc"
#include "nbgl_font_inter_semibold_28_1bpp.inc"
#include "nbgl_font_inter_medium_36_1bpp.inc"
#endif // TARGET_STAX
#else // SCREEN_SIZE_WALLET
#include "nbgl_font_open_sans_extrabold_11.inc"
Expand Down
Loading

0 comments on commit 252458c

Please sign in to comment.