Skip to content

Commit

Permalink
Merge pull request #597 from LedgerHQ/abo_update_level_18
Browse files Browse the repository at this point in the history
Update API LEVEL 18
  • Loading branch information
xchapron-ledger authored Apr 3, 2024
2 parents d64be6b + 0dd9b55 commit 3a95bd5
Show file tree
Hide file tree
Showing 53 changed files with 814 additions and 808 deletions.
392 changes: 89 additions & 303 deletions .github/workflows/build_all_apps.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/workflows/check_clang_static_analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ on:

jobs:
scan_build:
name: Clang Static Analyzer for NanoS, X, S+, and Stax
name: Clang Static Analyzer for all devices
strategy:
fail-fast: false
matrix:
target: [nanos, nanox, nanos2, stax]
target: [nanos, nanox, nanos2, stax, flex]
debug: [0, 1]
runs-on: ubuntu-latest
container:
Expand Down
10 changes: 5 additions & 5 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 europa
TARGETS := nanos nanox nanos2 stax flex
ifeq ($(TARGET),)
ifeq ("$(wildcard $(BOLOS_SDK)/.target)","")
$(error No TARGET specified and no .target file in SDK repository $(BOLOS_SDK))
Expand Down Expand Up @@ -153,7 +153,7 @@ LDFLAGS += -L$(BOLOS_SDK)/arch/st33/lib/
AFLAGS += -mcpu=cortex-m0plus -mtune=cortex-m0plus -mthumb
endif

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA TARGET_NANOS2))
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX TARGET_NANOS2))
CFLAGS += -mno-movt -frwpi --target=armv8m-none-eabi -mcpu=cortex-m35p+nodsp -mthumb -msoft-float -mtune=cortex-m35p+nodsp
LDFLAGS += -momit-leaf-frame-pointer
LDFLAGS += --target=armv8m-none-eabi
Expand All @@ -179,8 +179,8 @@ DEFINES += NBGL_USE_CASE
DEFINES += SCREEN_SIZE_WALLET
endif # TARGET_STAX

ifeq ($(TARGET_NAME),TARGET_EUROPA)
# For Europa NBGL must be used
ifeq ($(TARGET_NAME),TARGET_FLEX)
# For Flex NBGL must be used
USE_NBGL = 1
DEFINES += HAVE_BAGL_FONT_INTER_REGULAR_28PX
DEFINES += HAVE_BAGL_FONT_INTER_SEMIBOLD_28PX
Expand All @@ -194,7 +194,7 @@ DEFINES += NBGL_PAGE
DEFINES += NBGL_USE_CASE
DEFINES += SCREEN_SIZE_WALLET
DEFINES += HAVE_DISPLAY_FAST_MODE
endif # TARGET_EUROPA
endif # TARGET_FLEX

# For other devices, by default NBGL is not used
USE_NBGL ?= 0
Expand Down
8 changes: 4 additions & 4 deletions Makefile.glyphs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ ifneq ($(USE_NBGL),0)
# NBGL glyphs files and generation script
#
# search icons (glyphs) in lib_nbgl/glyphs(_nano) folder of the SDK
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs/wallet/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs/wallet/))))
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs/64px/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs/64px/))))
ifeq ($(TARGET_NAME),TARGET_STAX)
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs/32px/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs/32px/))))
endif
ifeq ($(TARGET_NAME),TARGET_EUROPA)
ifeq ($(TARGET_NAME),TARGET_FLEX)
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs/40px/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs/40px/))))
endif
GLYPH_OPT :=
else # ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
else # ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
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),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
endif # ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
ifneq (,$(wildcard $(ICONNAME)))
# Do not try to generate app icon glyph, if image does not exist
Expand Down
12 changes: 6 additions & 6 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 TARGET_EUROPA))
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX TARGET_FLEX))
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 HAVE_BLE_APDU
DEFINES += BLE_SEGMENT_SIZE=32
Expand All @@ -31,7 +31,7 @@ endif
# NFC #
#####################################################################
ifeq ($(ENABLE_NFC), 1)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME), TARGET_STAX TARGET_EUROPA))
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME), TARGET_STAX TARGET_FLEX))
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
DEFINES += HAVE_NFC
endif
Expand Down Expand Up @@ -133,20 +133,20 @@ endif
# NBGL #
#####################################################################
ifeq ($(ENABLE_NBGL_QRCODE), 1)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_EUROPA))
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
DEFINES += NBGL_QRCODE
SDK_SOURCE_PATH += qrcode
endif
endif

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

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

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ In short, to build an app for an OS, you should:
- `git pull`
- The last commit should be tagged with the complete version of the SDK (`v<N>.<x>.<y>`)
- Build the app from your app folder:
- `make BOLOS_SDK=<path_to_sdk> TARGET=<target>` where `target` is one of `nanos`, `nanox`, `nanos2`, `stax`, `europa` (`nanos2` is used for Nano S+ device).
- `make BOLOS_SDK=<path_to_sdk> TARGET=<target>` where `target` is one of `nanos`, `nanox`, `nanos2`, `stax`, `flex` (`nanos2` is used for Nano S+ device).

## About API_LEVEL branches

Expand All @@ -73,8 +73,10 @@ OS release candidates are only kept in the list when a corresponding OS release
| 12 | nanox_2.3.0-rc2 <br/> nanos+_1.2.0-rc2 | :x:
| 13 | stax_1.3.0 | :x:
| 14 | stax_1.4.0-rc1 | :x:
| 15 | stax_1.4.0-rc2 | :heavy_check_mark:
| 16 | europa_0.1.0-re1 | :heavy_check_mark:
| 15 | stax_1.4.0-rc2 <br/> stax_1.4.0-rc3 | :heavy_check_mark:
| 16 | europa_0.1.0-re1 | :x:
| 17 | europa_0.1.0-re2 | :x:
| 18 | europa_0.1.0-re3 <br/> nanox_2.3.0-rc5 <br/> nanos+_1.2.0-rc5 | :heavy_check_mark:

### Cherry-picking process:

Expand Down
8 changes: 8 additions & 0 deletions include/app_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef APP_CONFIG_H_
#define APP_CONFIG_H_

#ifdef BOLOS_OS_UPGRADER_APP
#include "osu_defines.h"
#endif

#endif /* !APP_CONFIG_H_ */
2 changes: 1 addition & 1 deletion include/cx_trampoline.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
#define CX_TRAMPOLINE_ADDR 0x00810001
#elif defined(TARGET_STAX)
#define CX_TRAMPOLINE_ADDR 0x00818001
#elif defined(TARGET_EUROPA)
#elif defined(TARGET_FLEX)
#define CX_TRAMPOLINE_ADDR 0x00818001
#endif
5 changes: 2 additions & 3 deletions include/os_io.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "app_config.h"
#include "bolos_target.h"
#include "os_math.h"
#include "decorators.h"
Expand Down Expand Up @@ -80,9 +81,7 @@ typedef struct io_touch_info_s {
uint8_t state;
uint8_t w;
uint8_t h;
#ifdef HAVE_HW_TOUCH_SWIPE
uint8_t swipe;
#endif // HAVE_HW_TOUCH_SWIPE
uint8_t swipe;
} io_touch_info_t;

// bitfield for exclusion borders, for touch_exclude_borders() (if a bit is set, means that pixels
Expand Down
2 changes: 2 additions & 0 deletions include/os_io_seproxyhal.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ void io_seproxyhal_send_nbgl_serialized(nbgl_serialized_event_type_e event, nbgl
void io_set_timeout(unsigned int timeout);

#ifdef HAVE_NFC
// Needs to be aligned with RFAL_FEATURE_ISO_DEP_IBLOCK_MAX_LEN defined on mcu side in platform.h
#define NFC_APDU_MAX_SIZE 256
void io_seproxyhal_nfc_power(bool forceInit);
#endif

Expand Down
1 change: 1 addition & 0 deletions include/os_print.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <stdio.h>
#include "app_config.h"

// avoid typing the size each time
#define SPRINTF(strbuf, ...) snprintf(strbuf, sizeof(strbuf), __VA_ARGS__)
Expand Down
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_EUROPA
#ifdef TARGET_FLEX
const uint8_t service_uuid[16] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x00,0x00,0x04,0x30,0x97,0x2C,0x00,0x34,0xD6,0x13,};
const uint8_t charUuidTX[16] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x01,0x00,0x04,0x30,0x97,0x2C,0x00,0x34,0xD6,0x13,};
const uint8_t charUuidRX[16] = {0x72,0x65,0x67,0x64,0x65,0x4c,0x02,0x00,0x04,0x30,0x97,0x2C,0x00,0x34,0xD6,0x13,};
Expand Down Expand Up @@ -458,7 +458,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)
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
#if defined(TARGET_STAX) || defined(TARGET_FLEX)
0x19); // 0 dBm
#else // !TARGET_STAX
0x07); // -14.1 dBm
Expand Down Expand Up @@ -778,7 +778,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);
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
#if defined(TARGET_STAX) || defined(TARGET_FLEX)
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 @@ -816,7 +816,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);
#if defined(TARGET_STAX) || defined(TARGET_EUROPA)
#if defined(TARGET_STAX) || defined(TARGET_FLEX)
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
2 changes: 2 additions & 0 deletions lib_cxng/src/cx_aes.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* @BANNER@ */

#include "app_config.h"

#ifdef HAVE_AES

#include "cx_cipher.h"
Expand Down
2 changes: 2 additions & 0 deletions lib_cxng/src/cx_crc16.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
********************************************************************************/

#include "app_config.h"

#ifdef HAVE_CRC

#include "lcx_crc.h"
Expand Down
2 changes: 2 additions & 0 deletions lib_cxng/src/cx_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
********************************************************************************/

#include "app_config.h"

#ifdef HAVE_HASH

#include <string.h>
Expand Down
2 changes: 2 additions & 0 deletions lib_cxng/src/cx_sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
********************************************************************************/

#include "app_config.h"

#if defined(HAVE_SHA256) || defined(HAVE_SHA224)

#include "cx_sha256.h"
Expand Down
5 changes: 3 additions & 2 deletions lib_nbgl/include/nbgl_content.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ typedef struct {
#ifdef SCREEN_SIZE_WALLET
const nbgl_icon_details_t *valueIcon; ///< a buffer containing the 32px 1BPP icon for icon on
///< right of value (can be NULL)
int8_t force_page_start : 1; ///< if set to 1, the tag will be displayed at the top of a new
///< review page
int8_t forcePageStart : 1; ///< if set to 1, the tag will be displayed at the top of a new
///< review page
int8_t centeredInfo : 1; ///< if set to 1, the tag will be displayed as a centered info
#endif
} nbgl_contentTagValue_t;

Expand Down
1 change: 1 addition & 0 deletions lib_nbgl/include/nbgl_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enum {
SCREEN_LOGGER,
LAYOUT_LOGGER,
PAGE_LOGGER,
USE_CASE_LOGGER,
TOUCH_LOGGER,
APP_LOGGER,
UX_LOGGER,
Expand Down
2 changes: 1 addition & 1 deletion lib_nbgl/include/nbgl_fonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extern "C" {

#else // TARGET_STAX

#ifdef TARGET_EUROPA
#ifdef TARGET_FLEX
#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
Expand Down
9 changes: 6 additions & 3 deletions lib_nbgl/include/nbgl_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ extern "C" {
/*********************
* DEFINES
*********************/
#define NBGL_NO_TUNE NB_TUNES
#define NBGL_NO_TUNE NB_TUNES
#define NBGL_NO_PROGRESS_INDICATOR 0xFF

#ifdef HAVE_SE_TOUCH
///< special code used as index of action callback to inform when Exit key (X) is
Expand All @@ -42,15 +43,17 @@ extern "C" {
#define TOUCHABLE_DETAILLED_BAR_HEIGHT 88
#define SIMPLE_FOOTER_HEIGHT 128
#define SMALL_CENTERING_HEADER 24
#define LONG_PRESS_BUTTON_HEIGHT 128
#else // TARGET_STAX
// only 2 buttons are visible at the same time on Europa
// only 2 buttons are visible at the same time on Flex
#define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 2
#define TOUCHABLE_HEADER_BAR_HEIGHT 96
#define TOUCHABLE_MAIN_BAR_HEIGHT 100
#define TOUCHABLE_BAR_HEIGHT 92
#define TOUCHABLE_DETAILLED_BAR_HEIGHT 140
#define SIMPLE_FOOTER_HEIGHT 96
#define SMALL_CENTERING_HEADER 40
#define LONG_PRESS_BUTTON_HEIGHT 152
#endif // TARGET_STAX

#define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * BORDER_MARGIN)
Expand Down Expand Up @@ -378,7 +381,7 @@ typedef enum {
FOOTER_SIMPLE_TEXT, ///< simple touchable text in bold
FOOTER_DOUBLE_TEXT, ///< 2 touchable texts in bold, separated by a vertical line (only on Stax)
FOOTER_TEXT_AND_NAV, ///< touchable text in bold on the left, navigation on the right (only on
///< Europa)
///< Flex)
FOOTER_NAV, ///< navigation bar
FOOTER_SIMPLE_BUTTON, ///< simple black or white button (see @ref nbgl_layoutButtonStyle_t)
FOOTER_CHOICE_BUTTONS, ///< double buttons (see @ref nbgl_layoutChoiceButtonsStyle_t)
Expand Down
13 changes: 12 additions & 1 deletion lib_nbgl/include/nbgl_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,27 @@ extern "C" {
#define VALIDATE_KEY '\r'

// for Keyboard
#ifdef NBGL_KEYBOARD
#ifdef HAVE_SE_TOUCH
#ifdef TARGET_STAX
#define KEYBOARD_KEY_HEIGHT 60
#else // TARGET_STAX
#define KEYBOARD_KEY_HEIGHT 72
#endif // TARGET_STAX
#else // HAVE_SE_TOUCH

// index of keys for keyMask field of nbgl_keyboard_t
#define SHIFT_KEY_INDEX 26
#define DIGITS_SWITCH_KEY_INDEX 27
#define BACKSPACE_KEY_INDEX 28
#define SPACE_KEY_INDEX 29
#define SPECIAL_KEYS_INDEX 30

#else // HAVE_SE_TOUCH
#define KEYBOARD_KEY_WIDTH 14
#define KEYBOARD_KEY_HEIGHT 14
#define KEYBOARD_WIDTH (5 * KEYBOARD_KEY_WIDTH)
#endif // HAVE_SE_TOUCH
#endif // NBGL_KEYBOARD

// for Keypad
#ifdef HAVE_SE_TOUCH
Expand Down Expand Up @@ -528,6 +538,7 @@ enum {
TOP_RIGHT_BUTTON_ID,
BACK_BUTTON_ID,
SINGLE_BUTTON_ID,
EXTRA_BUTTON_ID,
CHOICE_1_ID,
CHOICE_2_ID,
KEYPAD_ID,
Expand Down
2 changes: 1 addition & 1 deletion lib_nbgl/include/nbgl_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ typedef struct nbgl_pageNavWithButtons_s {
uint8_t navToken; ///< the token used as argument of the actionCallback when the nav buttons
///< are pressed (index param gives the page)
const char
*quitText; ///< the text displayed in footer (on the left), used to quit (only on Europa)
*quitText; ///< the text displayed in footer (on the left), used to quit (only on Flex)
} nbgl_pageNavWithButtons_t;

/**
Expand Down
Loading

0 comments on commit 3a95bd5

Please sign in to comment.