diff --git a/.gitignore b/.gitignore index 1063772f..f9b41931 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,11 @@ cmake-build-debug/ \.idea/workspace\.xml + +\.idea/ + +src/ledger/bin/ + +src/ledger/debug/ + +src/ledger/obj/ diff --git a/README.md b/README.md index 8b5da897..11849baf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ledger-ci +# ledger-ci-test [![CircleCI](https://circleci.com/gh/jleni/ledger-ci-test.svg?style=svg)](https://circleci.com/gh/jleni/ledger-ci-test) diff --git a/nanocli.sh b/nanocli.sh new file mode 100755 index 00000000..1130603a --- /dev/null +++ b/nanocli.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$(cd `dirname $0` && pwd) + +handle_config() +{ + os_string="$(uname -s)" + case "${os_string}" in + Linux*) + apt-get install libusb-1.0.0 + apt-get install libudev-dev + ;; + Darwin*) + brew install python3 + brew install libusb + ;; + *) + echo "OS not recognized" + ;; + esac + + pip3 install ledgerblue==0.1.15 +} + +handle_build() +{ + # This function works in the scope of the container + DOCKER_IMAGE=zondax/builder_bolos + BOLOS_SDK=/root/project/deps/nanos-secure-sdk + BOLOS_ENV=/opt/bolos + + docker run -it --rm \ + -e BOLOS_SDK=${BOLOS_SDK} \ + -e BOLOS_ENV=${BOLOS_ENV} \ + -v $(pwd):/root/project \ + ${DOCKER_IMAGE} \ + make -C /root/project/src/ledger $1 +} + +handle_load() +{ + # This function works in the scope of the host + export BOLOS_SDK=${SCRIPT_DIR}/deps/nanos-secure-sdk + export BOLOS_ENV=/opt/bolos + make -C ${SCRIPT_DIR}/src/ledger load +} + +handle_delete() +{ + # This function works in the scope of the host + export BOLOS_SDK=${SCRIPT_DIR}/deps/nanos-secure-sdk + export BOLOS_ENV=/opt/bolos + make -C ${SCRIPT_DIR}/src/ledger delete +} + +case "$1" in + build) handle_build;; + config) handle_config;; + load) handle_load;; + delete) handle_delete;; + upgrade) handle_delete && handle_load;; + *) + echo "ERROR. Valid commands: make, config, load, delete" + ;; +esac diff --git a/src/ledger/Makefile b/src/ledger/Makefile index b7b1e2fc..70680e20 100755 --- a/src/ledger/Makefile +++ b/src/ledger/Makefile @@ -93,10 +93,10 @@ SDK_SOURCE_PATH += lib_stusb lib_stusb_impl all: default load: all - python -m ledgerblue.loadApp $(APP_LOAD_PARAMS) + python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) delete: - python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) + python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) # Import generic rules from the SDK diff --git a/src/ledger/main.c b/src/ledger/src/main.c similarity index 69% rename from src/ledger/main.c rename to src/ledger/src/main.c index 0127ce57..4b782c83 100644 --- a/src/ledger/main.c +++ b/src/ledger/src/main.c @@ -1,5 +1,13 @@ #include +ux_state_t ux; +unsigned char G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B]; + +void ui_init() {} +void app_init() {} +void app_main() {} +unsigned char io_event(unsigned char channel) { return 1; } + __attribute__((section(".boot"))) int main(void) {