Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from IOTA-Ledger:master #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@ name: Build

on: [push, pull_request]

env:
DOCKER_IMAGE: 'wollac/ledger-bolos'

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
sdk-version: ['nanos-secure-sdk', 'blue-secure-sdk']
device: ['nanos', 'nanox', 'nanosplus']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Build using ${{ matrix.sdk-version }}
run: docker run -u $(id -u):$(id -g) -v $(pwd):/project -e BOLOS_SDK=/project/dev/sdk/${{ matrix.sdk-version }} $DOCKER_IMAGE make -C /project
- name: Build using ${{ matrix.device }}
run: ./build.sh -m ${{ matrix.device }}
36 changes: 0 additions & 36 deletions .github/workflows/clang.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codegov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive

Expand Down
12 changes: 9 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
[submodule "dev/sdk/blue-secure-sdk"]
path = dev/sdk/blue-secure-sdk
url = https://github.com/LedgerHQ/blue-secure-sdk.git
[submodule "dev/sdk/nanos-secure-sdk"]
path = dev/sdk/nanos-secure-sdk
url = https://github.com/LedgerHQ/nanos-secure-sdk.git
[submodule "tests"]
path = tests
url = https://github.com/IOTA-Ledger/ledger-app-iota-tests.git
branch = master
[submodule "dev/sdk/nanox-secure-sdk"]
path = dev/sdk/nanox-secure-sdk
url = https://github.com/LedgerHQ/nanox-secure-sdk
[submodule "dev/sdk/nanosplus-secure-sdk"]
path = dev/sdk/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/nanosplus-secure-sdk
[submodule "dev/speculos"]
path = dev/speculos
url = https://github.com/LedgerHQ/speculos
55 changes: 0 additions & 55 deletions Dockerfile

This file was deleted.

151 changes: 60 additions & 91 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,113 +1,89 @@
#*******************************************************************************
# Ledger App
# (c) 2017 Ledger
# ****************************************************************************
# Ledger App Boilerplate
# (c) 2020 Ledger SAS.
#
# 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
# 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
# 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.
#*******************************************************************************
# 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 ($(BOLOS_SDK),)
$(error Environment variable BOLOS_SDK is not set)
$(error Environment variable BOLOS_SDK is not set)
endif

include $(BOLOS_SDK)/Makefile.defines

APPNAME = "IOTA"
APPVERSION_MAJOR = 0
APPVERSION_MINOR = 5
APPVERSION_PATCH = 5
APPVERSION = $(APPVERSION_MAJOR).$(APPVERSION_MINOR).$(APPVERSION_PATCH)
APP_LOAD_PARAMS = --path "44'/4218'" --appFlags 0x240 $(COMMON_LOAD_PARAMS)

ifeq ($(TARGET_NAME),TARGET_BLUE)
ICONNAME = icons/blue_app_iota.gif
else ifeq ($(TARGET_NAME),TARGET_NANOX)
ICONNAME = icons/nanox_app_iota.gif
else ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME = icons/nanos_app_iota.gif
APPNAME = "IOTA Legacy"
APPVERSION_M = 0
APPVERSION_N = 5
APPVERSION_P = 9
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=icons/nanos_app_iota.gif
else
$(error unexpected target: $(TARGET_NAME))
ICONNAME=icons/nanox_app_iota.gif
endif


################
# Default rule #
################
all: default

############
# Platform #
############

DEFINES += $(DEFINES_LIB)

DEFINES += APPNAME=\"$(APPNAME)\"
DEFINES += APPVERSION=\"$(APPVERSION)\"
DEFINES += APPVERSION_MAJOR=$(APPVERSION_M) APPVERSION_MINOR=$(APPVERSION_N) APPVERSION_PATCH=$(APPVERSION_P)
DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_BAGL HAVE_SPRINTF HAVE_SNPRINTF_FORMAT_U
DEFINES += HAVE_BAGL HAVE_UX_FLOW HAVE_SPRINTF HAVE_SNPRINTF_FORMAT_U
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=6 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_MAJOR) LEDGER_MINOR_VERSION=$(APPVERSION_MINOR) LEDGER_PATCH_VERSION=$(APPVERSION_PATCH)

# U2F
DEFINES += HAVE_U2F HAVE_IO_U2F
DEFINES += U2F_PROXY_MAGIC=\"IOT\"
DEFINES += USB_SEGMENT_SIZE=64
DEFINES += BLE_SEGMENT_SIZE=32 #max MTU, min 20

# WebUSB
WEBUSB_URL = www.ledgerwallet.com
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=$(shell echo -n $(WEBUSB_URL) | wc -c) WEBUSB_URL=$(shell echo -n $(WEBUSB_URL) | sed -e "s/./\\\'\0\\\',/g")

DEFINES += APPVERSION_MAJOR=$(APPVERSION_MAJOR)
DEFINES += APPVERSION_MINOR=$(APPVERSION_MINOR)
DEFINES += APPVERSION_PATCH=$(APPVERSION_PATCH)
DEFINES += APPVERSION=\"$(APPVERSION)\"

DEFINES += BLE_SEGMENT_SIZE=32
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
DEFINES += UNUSED\(x\)=\(void\)x

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 HAVE_BLE_APDU
endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
else
# nanox, nanosplus
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_GLO096
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
DEFINES += HAVE_UX_FLOW
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
endif

DEBUG = 1
DEBUG = 0
ifneq ($(DEBUG),0)
# Development flags
APP_LOAD_PARAMS += --path "44'/01'"
DEFINES += HAVE_BOLOS_APP_STACK_CANARY
ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf
DEFINES += HAVE_BOLOS_APP_STACK_CANARY
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += PRINTF=screen_printf
else
DEFINES += HAVE_PRINTF PRINTF=screen_printf
# nanox, nanosplus
DEFINES += PRINTF=mcu_usb_printf
endif
else
# Release flags
DEFINES += PRINTF\(...\)=
DEFINES += PRINTF\(...\)=
endif

##############
# Compiler #
##############
ifneq ($(BOLOS_ENV),)
$(info BOLOS_ENV=$(BOLOS_ENV))
CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/
GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/
GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/
else
$(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH)
endif
Expand All @@ -118,41 +94,34 @@ ifeq ($(GCCPATH),)
$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH)
endif

CC := $(CLANGPATH)clang
CFLAGS += -O3 -Os

AS := $(GCCPATH)arm-none-eabi-gcc
AFLAGS +=

LD := $(GCCPATH)arm-none-eabi-gcc
CC := $(CLANGPATH)clang
CFLAGS += -O3 -Os
AS := $(GCCPATH)arm-none-eabi-gcc
LD := $(GCCPATH)arm-none-eabi-gcc
LDFLAGS += -O3 -Os
LDLIBS += -lm -lgcc -lc
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
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_u2f
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_ux

ifeq ($(TARGET_NAME),TARGET_NANOX)
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
SDK_SOURCE_PATH += lib_ux
endif

load: all
python -m ledgerblue.loadApp $(APP_LOAD_PARAMS)
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS)

load-offline: all
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) --offline

delete:
python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)
python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)

# import generic rules from the sdk
include $(BOLOS_SDK)/Makefile.rules

#add dependency on custom makefile filename
dep/%.d: %.c Makefile



listvariants:
@echo VARIANTS COIN iota
@echo VARIANTS COIN iota_legacy
Loading