diff --git a/.ci/travis-ci b/.ci/travis-ci index 678fb9a99c..923557554c 100755 --- a/.ci/travis-ci +++ b/.ci/travis-ci @@ -1,9 +1,24 @@ +# Copyright 2019 Shift Cryptosecurity AG +# Copyright 2020 Shift Crypto AG +# +# 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. + #!/bin/bash set -e set -x -CONTAINER=shiftcrypto/firmware_v2:15 +CONTAINER=shiftcrypto/firmware_v2:16 if [ "$1" == "pull" ] ; then docker pull "$CONTAINER" diff --git a/Dockerfile b/Dockerfile index 57c42e4dc3..ddc5e69fc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ # Copyright 2019 Shift Cryptosecurity AG +# Copyright 2020 Shift Crypto AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -121,7 +122,7 @@ ENV GOPATH /opt/go ENV GOROOT /opt/go_dist/go ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH RUN mkdir -p /opt/go_dist && \ - curl https://dl.google.com/go/go1.11.linux-amd64.tar.gz | tar -xz -C /opt/go_dist + curl https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz | tar -xz -C /opt/go_dist RUN go get -v -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc diff --git a/rust-toolchain b/rust-toolchain index 8bd4ff0a8a..372cf402c7 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-04-06 +1.44.0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 500fd95de3..fe43ac3cfa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,6 @@ # Copyright (c) 2015-2016 Lucas Betschart, Douglas J. Bakkum # Copyright 2019 Shift Cryptosecurity AG +# Copyright 2020 Shift Crypto AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -449,8 +450,12 @@ foreach(type ${RUST_LIBS}) RUSTC_BOOTSTRAP=1 ${CARGO} build --manifest-path ${LIBBITBOX02_RUST_SOURCE_DIR}/Cargo.toml --features target-${type} --target-dir ${RUST_BINARY_DIR} ${RUST_CARGO_FLAG} ${RUST_TARGET_ARCH_ARG} # Rust packages stdlib functions which we must remove/weaken on the arm target + # Currently the removed symbols only clash in device-tests for some reason. Without this command, compiling device tests would result in errors like: + # Linking C executable ../../bin/fw_test_usb_cmd_process.elf + # /usr/local/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld: /usr/local/bin/../lib/gcc/arm-none-eabi/8.2.1/thumb/v7e-m+fp/softfp/libgcc.a(_arm_addsubdf3.o): in function `__aeabi_dsub': + # (.text+0x8): multiple definition of `__aeabi_dsub'; ../../lib/libfirmware_rust_c.a(compiler_builtins-5829be534503bd8e.compiler_builtins.cthmhl66-cgu.175.rcgu.o):/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.27/src/macros.rs:226: first defined here COMMAND - if test "x${RUST_TARGET_ARCH}" = "xthumbv7em-none-eabi" \; then ${CMAKE_OBJCOPY} -N memset -N memcpy -N memmove -W memcmp ${lib} \; fi + if test "x${RUST_TARGET_ARCH}" = "xthumbv7em-none-eabi" \; then ${CMAKE_OBJCOPY} -W __aeabi_dsub -W __aeabi_dadd -W__aeabi_i2d -W __aeabi_f2d -W __aeabi_dmul ${lib} \; fi COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/lib${type}_rust_c.a BYPRODUCTS @@ -466,7 +471,15 @@ if(CMAKE_CROSSCOMPILING) add_custom_target(rust-docs COMMAND - ${CMAKE_COMMAND} -E env CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} SYSROOT=${CMAKE_SYSROOT} INCLUDES="${RUST_INCLUDES}" ${CARGO} doc --document-private-items --manifest-path ${LIBBITBOX02_RUST_SOURCE_DIR}/Cargo.toml --target-dir ${CMAKE_BINARY_DIR}/docs-rust ${RUST_CARGO_FLAG} --target thumbv7em-none-eabi + ${CMAKE_COMMAND} -E env + # enable nightly features in the stable release - needed to activate alloc_error_handler. + # see src/rust/bitbox02-rust-c/src/lib.rs. + # https://github.com/rust-lang/rust/issues/66740 + RUSTC_BOOTSTRAP=1 + CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} + SYSROOT=${CMAKE_SYSROOT} + INCLUDES="${RUST_INCLUDES}" + ${CARGO} doc --document-private-items --manifest-path ${LIBBITBOX02_RUST_SOURCE_DIR}/Cargo.toml --target-dir ${CMAKE_BINARY_DIR}/docs-rust ${RUST_CARGO_FLAG} --target thumbv7em-none-eabi COMMAND ${CMAKE_COMMAND} -E echo "See docs at file://${CMAKE_BINARY_DIR}/docs-rust/thumbv7em-none-eabi/doc/bitbox02_rust/index.html" )