Skip to content

Commit

Permalink
Merge pull request #659 from LedgerHQ/lpa/update_api_level_15
Browse files Browse the repository at this point in the history
Update API_LEVEL_15
  • Loading branch information
lpascal-ledger committed May 15, 2024
2 parents 3ecacd6 + c872c63 commit 01b3538
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 54 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/build_all_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install tomlq
run: |
Expand Down Expand Up @@ -105,24 +105,18 @@ jobs:

steps:
- name: Clone App
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: LedgerHQ/${{ matrix.repo_info.repo_name }}
ref: ${{ matrix.repo_info.default_branch }}
submodules: true

- name: Clone SDK
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: sdk
ref: ${{ inputs.sdk_branch }}

- name: Build NanoS
if: "startsWith(matrix.repo_info.devices, 'nanos,')"
run: |
[ -n '${{ matrix.repo_info.build_directory }}' ] && cd ${{ matrix.repo_info.build_directory }}
TARGET=nanos BOLOS_SDK=$GITHUB_WORKSPACE/sdk make
- name: Build NanoX
if: "contains(matrix.repo_info.devices, 'nanox')"
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check_clang_static_analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ jobs:
strategy:
fail-fast: false
matrix:
target: [nanos, nanox, nanos2, stax]
target: [nanox, nanos2, stax]
debug: [0, 1]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest

steps:
- name: Clone Boilerplate
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: LedgerHQ/app-boilerplate
ref: master

- name: Clone SDK
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: sdk

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build unit tests
run: |
Expand Down
46 changes: 6 additions & 40 deletions Makefile.defines
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#*******************************************************************************
# Ledger SDK
# (c) 2017 Ledger
# (c) 2024 Ledger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,34 +15,12 @@
# limitations under the License.
#*******************************************************************************

# 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
ifeq ($(TARGET),)
ifeq ("$(wildcard $(BOLOS_SDK)/.target)","")
$(error No TARGET specified and no .target file in SDK repository $(BOLOS_SDK))
else
TARGET := $(shell cat $(BOLOS_SDK)/.target)
endif
endif
ifeq ($(__MAKEFILE_DEFINES__),)
__MAKEFILE_DEFINES__ := 1

ifeq ($(filter $(TARGET),$(TARGETS)),)
$(error TARGET not set to a valid value (possible values: $(TARGETS)))
endif
include $(BOLOS_SDK)/Makefile.target

API_LEVEL := 15
TARGET_PATH := $(BOLOS_SDK)/target/$(TARGET)
TARGET_ID := $(shell cat $(TARGET_PATH)/include/bolos_target.h | grep TARGET_ID | cut -f3 -d' ')
TARGET_NAME := $(shell cat $(TARGET_PATH)/include/bolos_target.h | grep TARGET_ | grep -v TARGET_ID | cut -f2 -d' ')
SDK_NAME := "ledger-secure-sdk"
SDK_VERSION := $(shell git -C $(BOLOS_SDK) describe --tags --exact-match --match "v[0-9]*" --dirty)
SDK_HASH := $(shell git -C $(BOLOS_SDK) describe --always --dirty --exclude '*' --abbrev=40)
ifeq ($(SDK_VERSION),)
SDK_VERSION := "None"
endif
ifeq ($(SDK_HASH),)
SDK_HASH := "None"
endif
API_LEVEL := 15

# APPNAME exposed to the app as a CFLAG because it might contain spaces
CFLAGS += -DAPPNAME=\"$(APPNAME)\"
Expand All @@ -56,23 +34,12 @@ APP_METADATA_LIST := TARGET TARGET_NAME APPVERSION SDK_NAME SDK_VERSION SDK_HASH
DEFINES += $(foreach item,$(APP_METADATA_LIST), $(item)=\"$($(item))\")


BUILD_DIR := build
TARGET_BUILD_DIR := $(BUILD_DIR)/$(TARGET)
BIN_DIR := $(TARGET_BUILD_DIR)/bin
OBJ_DIR := $(TARGET_BUILD_DIR)/obj
DBG_DIR := $(TARGET_BUILD_DIR)/dbg
DEP_DIR := $(TARGET_BUILD_DIR)/dep
GEN_SRC_DIR := $(TARGET_BUILD_DIR)/gen_src

### platform definitions
DEFINES += gcc __IO=volatile

# no assert by default
DEFINES += NDEBUG

# Debug mode disabled by default
DEBUG:=0

# default is not to display make commands
log = $(if $(strip $(VERBOSE)),$1,@$1) # kept for retrocompat
L = $(if $(strip $(VERBOSE)),,@)
Expand Down Expand Up @@ -224,5 +191,4 @@ endif
# include builtin CX libs options
-include $(BOLOS_SDK)/Makefile.conf.cx

# define the default makefile target (high in include to avoid glyph.h or what not specific target to be the default one when no target passed on the make command line)
all: default
endif
4 changes: 4 additions & 0 deletions Makefile.standard_app
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#*******************************************************************************

include $(BOLOS_SDK)/Makefile.target

#####################################################################
# BLUETOOTH #
#####################################################################
Expand Down Expand Up @@ -213,6 +215,8 @@ ifeq ($(TARGET_NAME), TARGET_FLEX)
ICONNAME ?= $(ICON_FLEX)
endif

include $(BOLOS_SDK)/Makefile.defines

include $(BOLOS_SDK)/Makefile.glyphs

load: all
Expand Down
63 changes: 63 additions & 0 deletions Makefile.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#*******************************************************************************
# Ledger SDK
# (c) 2024 Ledger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#*******************************************************************************

ifeq ($(__MAKEFILE_TARGET__),)
__MAKEFILE_TARGET__ := 1

# 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 flex
ifeq ($(TARGET),)
ifeq ("$(wildcard $(BOLOS_SDK)/.target)","")
$(error No TARGET specified and no .target file in SDK repository $(BOLOS_SDK))
else
TARGET := $(shell cat $(BOLOS_SDK)/.target)
endif
endif

ifeq ($(filter $(TARGET),$(TARGETS)),)
$(error TARGET not set to a valid value (possible values: $(TARGETS)))
endif

TARGET_PATH := $(BOLOS_SDK)/target/$(TARGET)
TARGET_ID := $(shell cat $(TARGET_PATH)/include/bolos_target.h | grep TARGET_ID | cut -f3 -d' ')
TARGET_NAME := $(sort $(shell cat $(TARGET_PATH)/include/bolos_target.h | grep TARGET_ | grep -v TARGET_ID | cut -f2 -d' '))
SDK_NAME := "ledger-secure-sdk"
SDK_VERSION := $(shell git -C $(BOLOS_SDK) describe --tags --exact-match --match "v[0-9]*" --dirty)
SDK_HASH := $(shell git -C $(BOLOS_SDK) describe --always --dirty --exclude '*' --abbrev=40)
ifeq ($(SDK_VERSION),)
SDK_VERSION := "None"
endif
ifeq ($(SDK_HASH),)
SDK_HASH := "None"
endif

BUILD_DIR := build
TARGET_BUILD_DIR := $(BUILD_DIR)/$(TARGET)
BIN_DIR := $(TARGET_BUILD_DIR)/bin
OBJ_DIR := $(TARGET_BUILD_DIR)/obj
DBG_DIR := $(TARGET_BUILD_DIR)/dbg
DEP_DIR := $(TARGET_BUILD_DIR)/dep
GEN_SRC_DIR := $(TARGET_BUILD_DIR)/gen_src

# Debug mode disabled by default
DEBUG:=0

# define the default makefile target (high in include to avoid glyph.h or what not specific target to be the default one when no target passed on the make command line)
all: default

endif
11 changes: 11 additions & 0 deletions include/cx_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@
* Checks the error code of a function.
* @hideinitializer
*/
#ifdef HAVE_BOLOS
#define CX_CHECK(call) \
do { \
error = call; \
if (error) { \
goto end; \
} \
} while (0)
#else
#define CX_CHECK(call) \
do { \
error = call; \
if (error) { \
PRINTF("[CX_CHECK] - %s: %d\n", __FILE__, __LINE__); \
goto end; \
} \
} while (0)
#endif

/**
* Checks the error code of a function and ignore
Expand Down
20 changes: 20 additions & 0 deletions lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,11 @@ void nbgl_useCaseReview(nbgl_operationType_t operationType,
uint8_t nbPages = nbgl_useCaseGetNbPagesForGenericContents(&genericContext.genericContents, 0);
prepareNavInfo(true, nbPages, getRejectReviewText(operationType));

#ifdef HAVE_PIEZO_SOUND
// Play notification sound
io_seproxyhal_play_tune(TUNE_LOOK_AT_ME);
#endif // HAVE_PIEZO_SOUND

displayGenericContextPage(0, true);
}

Expand Down Expand Up @@ -2369,6 +2374,11 @@ void nbgl_useCaseReviewLight(nbgl_operationType_t operationType,
uint8_t nbPages = nbgl_useCaseGetNbPagesForGenericContents(&genericContext.genericContents, 0);
prepareNavInfo(true, nbPages, getRejectReviewText(operationType));

#ifdef HAVE_PIEZO_SOUND
// Play notification sound
io_seproxyhal_play_tune(TUNE_LOOK_AT_ME);
#endif // HAVE_PIEZO_SOUND

displayGenericContextPage(0, true);
}

Expand Down Expand Up @@ -2446,6 +2456,11 @@ void nbgl_useCaseReviewStreamingStart(nbgl_operationType_t operationType,
= nbgl_useCaseGetNbPagesForGenericContents(&genericContext.genericContents, 0);
prepareNavInfo(true, NBGL_NO_PROGRESS_INDICATOR, getRejectReviewText(operationType));

#ifdef HAVE_PIEZO_SOUND
// Play notification sound
io_seproxyhal_play_tune(TUNE_LOOK_AT_ME);
#endif // HAVE_PIEZO_SOUND

displayGenericContextPage(0, true);
}

Expand Down Expand Up @@ -2683,6 +2698,11 @@ void nbgl_useCaseAddressReview(const char *address,
prepareNavInfo(true, nbPages, "Reject");
#endif // TARGET_STAX

#ifdef HAVE_PIEZO_SOUND
// Play notification sound
io_seproxyhal_play_tune(TUNE_LOOK_AT_ME);
#endif // HAVE_PIEZO_SOUND

displayGenericContextPage(0, true);
}

Expand Down

0 comments on commit 01b3538

Please sign in to comment.