-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from SiaFoundation/ledger-review-fixes
Ledger Review Fixes
- Loading branch information
Showing
225 changed files
with
1,202 additions
and
1,515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
Language: Cpp | ||
ColumnLimit: 100 | ||
PointerAlignment: Right | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveMacros: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
SortIncludes: false | ||
SpaceAfterCStyleCast: true | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortFunctionsOnASingleLine: None | ||
BinPackArguments: false | ||
BinPackParameters: false |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,109 @@ | ||
#******************************************************************************* | ||
# Ledger App | ||
# (c) 2017 Ledger | ||
# **************************************************************************** | ||
# Ledger App Boilerplate | ||
# (c) 2023 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) | ||
endif | ||
include $(BOLOS_SDK)/Makefile.defines | ||
|
||
######### | ||
# App # | ||
######### | ||
include $(BOLOS_SDK)/Makefile.defines | ||
|
||
APPNAME = Sia | ||
APPVERSION = 0.4.4 | ||
ifeq ($(TARGET_NAME),TARGET_NANOS) | ||
ICONNAME=nanos_app_sia.gif | ||
else ifeq ($(TARGET_NAME),TARGET_NANOX) | ||
ICONNAME=nanox_app_sia.gif | ||
else ifeq ($(TARGET_NAME),TARGET_STAX) | ||
ICONNAME=stax_app_sia.gif | ||
endif | ||
######################################## | ||
# Mandatory configuration # | ||
######################################## | ||
# Application name | ||
APPNAME = "Sia" | ||
|
||
# The --path argument here restricts which BIP32 paths the app is allowed to derive. | ||
APP_LOAD_PARAMS = --path "44'/93'" --curve ed25519 $(COMMON_LOAD_PARAMS) | ||
ifeq ($(TARGET_NAME),TARGET_NANOS) | ||
APP_LOAD_PARAMS += --appFlags 0x40 | ||
else ifeq ($(TARGET_NAME),TARGET_NANOX) | ||
APP_LOAD_PARAMS += --appFlags 0x40 | ||
else ifeq ($(TARGET_NAME), TARGET_STAX) | ||
APP_LOAD_PARAMS += --appFlags 0x240 | ||
endif | ||
# Application version | ||
APPVERSION_M = 1 | ||
APPVERSION_N = 0 | ||
APPVERSION_P = 0 | ||
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" | ||
|
||
# Application source files | ||
APP_SOURCE_PATH += src | ||
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl | ||
ifneq ($(TARGET_NAME),TARGET_STAX) | ||
SDK_SOURCE_PATH += lib_ux | ||
endif | ||
|
||
all: default | ||
|
||
load: all | ||
python -m ledgerblue.loadApp $(APP_LOAD_PARAMS) | ||
|
||
delete: | ||
python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) | ||
|
||
############ | ||
# Platform # | ||
############ | ||
|
||
DEFINES += OS_IO_SEPROXYHAL | ||
DEFINES += HAVE_SPRINTF | ||
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=7 IO_HID_EP_LENGTH=64 HAVE_USB_APDU | ||
# Application icons following guidelines: | ||
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon | ||
ICON_NANOS = nanos_app_sia.gif | ||
ICON_NANOX = nanox_app_sia.gif | ||
ICON_NANOSP = nanos2_app_sia.gif | ||
ICON_STAX = stax_app_sia.gif | ||
|
||
# Application allowed derivation curves. | ||
# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1 | ||
# If your app needs it, you can specify multiple curves by using: | ||
# `CURVE_APP_LOAD_PARAMS = <curve1> <curve2>` | ||
CURVE_APP_LOAD_PARAMS = ed25519 | ||
|
||
# Application allowed derivation paths. | ||
# You should request a specific path for your app. | ||
# This serve as an isolation mechanism. | ||
# Most application will have to request a path according to the BIP-0044 | ||
# and SLIP-0044 standards. | ||
# If your app needs it, you can specify multiple path by using: | ||
# `PATH_APP_LOAD_PARAMS = "44'/1'" "45'/1'"` | ||
PATH_APP_LOAD_PARAMS = "44'/93'" | ||
|
||
# Setting to allow building variant applications | ||
# - <VARIANT_PARAM> is the name of the parameter which should be set | ||
# to specify the variant that should be build. | ||
# - <VARIANT_VALUES> a list of variant that can be build using this app code. | ||
# * It must at least contains one value. | ||
# * Values can be the app ticker or anything else but should be unique. | ||
VARIANT_PARAM = COIN | ||
VARIANT_VALUES = sia | ||
|
||
# Enabling DEBUG flag will enable PRINTF and disable optimizations | ||
#DEBUG = 1 | ||
|
||
######################################## | ||
# Application custom permissions # | ||
######################################## | ||
# See SDK `include/appflags.h` for the purpose of each permission | ||
#HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1 | ||
#HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1 | ||
#HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1 | ||
#HAVE_APPLICATION_FLAG_LIBRARY = 1 | ||
|
||
######################################## | ||
# Application communication interfaces # | ||
######################################## | ||
ENABLE_BLUETOOTH = 1 | ||
#ENABLE_NFC = 1 | ||
|
||
######################################## | ||
# NBGL custom features # | ||
######################################## | ||
#ENABLE_NBGL_QRCODE = 1 | ||
#ENABLE_NBGL_KEYBOARD = 1 | ||
#ENABLE_NBGL_KEYPAD = 1 | ||
|
||
######################################## | ||
# Features disablers # | ||
######################################## | ||
# These advanced settings allow to disable some feature that are by | ||
# default enabled in the SDK `Makefile.standard_app`. | ||
#DISABLE_STANDARD_APP_FILES = 1 | ||
#DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1 # To allow custom size declaration | ||
#DISABLE_STANDARD_APP_DEFINES = 1 # Will set all the following disablers | ||
#DISABLE_STANDARD_SNPRINTF = 1 | ||
#DISABLE_STANDARD_USB = 1 | ||
#DISABLE_STANDARD_WEBUSB = 1 | ||
#DISABLE_STANDARD_BAGL_UX_FLOW = 1 | ||
DEFINES += HAVE_LEGACY_PID | ||
DEFINES += APPNAME=\"$(APPNAME)\" | ||
DEFINES += APPVERSION=\"$(APPVERSION)\" | ||
DEFINES += UNUSED\(x\)=\(void\)x | ||
|
||
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS)) | ||
DEFINES += HAVE_BAGL | ||
DEFINES += HAVE_UX_FLOW | ||
endif | ||
|
||
### Nano X | ||
ifeq ($(TARGET_NAME),TARGET_NANOS) | ||
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128 | ||
else ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) | ||
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 | ||
# bluetooth | ||
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 | ||
DEFINES += HAVE_BLE_APDU | ||
# include fonts or ui will be empty | ||
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl | ||
endif | ||
|
||
ifeq ($(TARGET_NAME),TARGET_NANOX) | ||
DEFINES += HAVE_BAGL_ELLIPSIS | ||
DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=64 | ||
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX | ||
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX | ||
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX | ||
endif | ||
|
||
|
||
############## | ||
# Compiler # | ||
############## | ||
|
||
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 | ||
|
||
################## | ||
# Dependencies # | ||
################## | ||
|
||
# import rules to compile glyphs | ||
include $(BOLOS_SDK)/Makefile.glyphs | ||
# import generic rules from the sdk | ||
include $(BOLOS_SDK)/Makefile.rules | ||
|
||
dep/%.d: %.c Makefile | ||
|
||
listvariants: | ||
@echo VARIANTS COIN sia | ||
include $(BOLOS_SDK)/Makefile.standard_app |
Oops, something went wrong.