Skip to content

Commit 88d48f9

Browse files
committed
Merge remote-tracking branch 'benma/docker'
2 parents 2e7816c + d88c9cb commit 88d48f9

File tree

31 files changed

+73
-245
lines changed

31 files changed

+73
-245
lines changed

.ci/ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ make -j8 factory-setup
5050
make -j8 bootloader-semihosting
5151
make -j8 firmware-semihosting
5252

53-
make -C tools/go/src/atecc608a test
53+
(cd tools/atecc608a; go test ./...)
5454

5555
# Don't generate graphics in CI
5656
(cd build; cmake -DDOC_GRAPHS=NO ..)

.ci/run-container-ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
set -e
2626
set -x
2727

28-
CONTAINER=shiftcrypto/firmware_v2:28
28+
CONTAINER=shiftcrypto/firmware_v2:29
2929

3030
if [ "$1" == "pull" ] ; then
3131
docker pull "$CONTAINER"

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RUN mkdir ~/Downloads &&\
3737
# Tools for building
3838
RUN apt-get update && apt-get install -y \
3939
build-essential \
40-
llvm \
40+
llvm-15 \
4141
gcc-10 \
4242
binutils \
4343
valgrind \
@@ -115,7 +115,7 @@ ENV GOPATH /opt/go
115115
ENV GOROOT /opt/go_dist/go
116116
ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH
117117
RUN mkdir -p /opt/go_dist && \
118-
curl https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz | tar -xz -C /opt/go_dist
118+
curl https://dl.google.com/go/go1.19.3.linux-amd64.tar.gz | tar -xz -C /opt/go_dist
119119

120120
# Install lcov from release (the one from the repos is too old).
121121
RUN cd /opt && wget https://github.com/linux-test-project/lcov/releases/download/v1.14/lcov-1.14.tar.gz && tar -xf lcov-1.14.tar.gz
@@ -129,8 +129,8 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/opt/
129129
RUN rustup target add thumbv7em-none-eabi
130130
RUN rustup component add rustfmt
131131
RUN rustup component add clippy
132-
RUN CARGO_HOME=/opt/cargo cargo install cbindgen --version 0.23.0
133-
RUN CARGO_HOME=/opt/cargo cargo install bindgen --version 0.59.2
132+
RUN CARGO_HOME=/opt/cargo cargo install cbindgen --version 0.24.3
133+
RUN CARGO_HOME=/opt/cargo cargo install bindgen-cli --version 0.61.0
134134

135135
COPY tools/prost-build prost-build
136136
RUN CARGO_HOME=/opt/cargo cargo install --path prost-build --locked

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ dockerdev:
127127
dockerrel:
128128
./scripts/dockerenv.sh release
129129
generate-atecc608-config:
130-
${MAKE} -C tools/go/src/atecc608a run
130+
cd tools/atecc608a && go run main.go
131131
ci:
132132
./.ci/ci
133133
prepare-tidy: | build build-build

messages/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ add_custom_command(
3333
# Using prost-build the normal way as part of build.rs does not work due to a cargo bug:
3434
# https://github.com/danburkert/prost/issues/344#issuecomment-650721245
3535
COMMAND
36-
${PROST_BUILD} --messages-dir=${CMAKE_CURRENT_SOURCE_DIR} --out-dir=${CMAKE_SOURCE_DIR}/src/rust/bitbox02-rust/src/
36+
${PROST_BUILD} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/rust/bitbox02-rust/src/
3737
)
3838

3939
add_custom_target(

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ if(NOT CMAKE_CROSSCOMPILING)
453453
-A clippy::manual_range_contains
454454
-A clippy::match_ref_pats
455455
-A clippy::enum_variant_names
456+
-A clippy::derive_partial_eq_without_eq
457+
-A clippy::forget_non_drop
456458
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/rust/
457459
)
458460
add_dependencies(rust-clippy rust-bindgen generate-protobufs)

src/rust/bitbox02-rust-c/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ sha3 = { version = "0.9.1", default-features = false, optional = true }
3333
bs58 = { version = "0.4.0", default-features = false, features = ["alloc", "check"] }
3434

3535
[features]
36-
# "Negative" feature is a hack because tests are ran with `--all-features`, currently without a way to exclude specific features.
37-
# This should be enabled for Rust unit tests and Clippy, and not enabled for the firmware targets and the C unit tests.
38-
dont-export-eh-personality = []
39-
4036
# Only one of the "target-" should be activated, which in turn defines/activates the dependent features.
4137
target-bootloader = ["bootloader", "platform-bitbox02"]
4238
target-bootloader-development = ["bootloader", "platform-bitbox02"]

src/rust/bitbox02-rust-c/src/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn bitbox02_alloc_error_handler(layout: core::alloc::Layout) -> ! {
2323
struct BB02Allocator;
2424

2525
extern "C" {
26-
pub fn malloc(size: util::c_types::size_t) -> *mut util::c_types::c_void;
26+
pub fn malloc(size: usize) -> *mut util::c_types::c_void;
2727
pub fn free(p: *mut util::c_types::c_void);
2828
}
2929

src/rust/bitbox02-rust-c/src/lib.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,3 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
5151
bitbox02_rust::print_debug!(0, "Error: {}", info);
5252
loop {}
5353
}
54-
55-
// Needed to link the C unit test executables in /test/unit-test.
56-
//
57-
// See https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib.
58-
//
59-
// One could get rid of this and also considerably shrink the binary size by compiling core instead
60-
// of using pre-built binaries. See a proof of concept implementation here:
61-
// https://github.com/digitalbitbox/bitbox02-firmware/tree/build-std-PoC. We decided against doing
62-
// this for now as the feature seems immature and because of the warnings against using it in
63-
// production:
64-
// https://github.com/rust-lang/wg-cargo-std-aware/tree/81765f0eb744b9c47840c16f43a32c9f61fd7f0c#mvp-implementation
65-
#[cfg(not(feature = "dont-export-eh-personality"))]
66-
#[lang = "eh_personality"]
67-
#[no_mangle]
68-
pub extern "C" fn rust_eh_personality() {}

src/rust/bitbox02-rust-c/src/sha2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub unsafe extern "C" fn rust_sha256_finish(ctx: *mut *mut c_void, out: *mut c_u
5757
pub unsafe extern "C" fn rust_sha256_free(ctx: *mut *mut c_void) {
5858
if !(*ctx).is_null() {
5959
#[allow(clippy::cast_ptr_alignment)] // ctx is properly aligned, see `Box::into_raw`.
60-
Box::from_raw(*ctx as *mut Sha256);
60+
drop(Box::from_raw(*ctx as *mut Sha256));
6161
*ctx = core::ptr::null_mut();
6262
}
6363
}

0 commit comments

Comments
 (0)