Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 16 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# Include host-specific Cargo settings generated by scripts/bootstrap-cargo-config.
include = [{ path = "config.local.toml", optional = true }]

[build]
# Use our own copy of libsecp256k1-zpk instead of the one bundled with secp256k1-sys, also in `cargo
# test` and other cargo-based builds. This is replicated in src/CMakeLists.txt,
# test/simulator-graphical*/CMakeLists.txt for CMake-based builds.
# See https://github.com/rust-bitcoin/rust-secp256k1/tree/7c8270a8506e31731e540fab7ee1abde1f48314e/secp256k1-sys#linking-to-external-symbols
rustflags = ["--cfg", "rust_secp_no_symbol_renaming"]

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
rustflags = [
"--cfg", "rust_secp_no_symbol_renaming",
"-C", "linker-plugin-lto",
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
"-C", "link-arg=--nmagic",
]
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/py/bitbox02/bitbox02/generated/* linguist-generated=true
/src/rust/bitbox-proto/src/generated/* linguist-generated=true
/external/vendor/** linguist-generated=true
/external/ST/Drivers/** linguist-generated=true
18 changes: 17 additions & 1 deletion .github/workflows/ci-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ jobs:
- firmware-btc
- factory-setup
- firmware-debug
- bitbox03-boot0
- bitbox03-boot1
- bitbox03-factorysetup
- bitbox03-firmware
- simulator
- simulator-graphical
- simulator-graphical-bb03
Expand All @@ -238,6 +242,9 @@ jobs:
- name: Mark directory as safe
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- name: Bootstrap Cargo config
run: ./scripts/bootstrap-cargo-config

- name: Build ${{ matrix.target }}
run: make -j$(($(nproc)+1)) ${{ matrix.target }}

Expand All @@ -246,7 +253,15 @@ jobs:
run: ./.ci/check-unwanted-symbols

- name: Print hashes
run: sha256sum build*/bin/*
run: |
{
for dir in build*/bin src/rust/target/thumbv8m.main-none-eabihf/debug; do
if [ -d "$dir" ]; then
find "$dir" -maxdepth 1 -type f -print0
fi
done
true
} | xargs -0 -r sha256sum

- name: Upload artifact
if: github.event_name == 'push' && !cancelled()
Expand All @@ -258,6 +273,7 @@ jobs:
build*/bin/*.elf
build*/bin/*.map
build*/bin/simulator*
src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-*

# Build simulators for macos aarch64
build-macos:
Expand Down
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ toolchain or compiler environment.
In practice, the repository `make` targets in this file are project-specific toolchain commands.
When running from the host, invoke them via `./scripts/dev_exec.sh make <target>`.

Treat the top-level Makefile as a collection of command aliases, not as a dependency graph. Do not
add prerequisites or dependency edges to Make targets to encode setup requirements. If a target needs
setup such as `./scripts/bootstrap-cargo-config`, run that setup explicitly before invoking the
alias, or add an explicit setup step in CI.

Do not wrap `./scripts/dev_exec.sh` itself in `bash -lc`. Prefer changing CWD
with CLI args like `tar -C <PATH>`. If a command genuinely needs shell features such as pipes, pass
an explicit shell as the command, e.g. `./scripts/dev_exec.sh bash -lc 'cat versions.json | jq'`.
Expand Down
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,47 @@ clean:
# When you vendor rust libs avoid duplicates
vendor-rust-deps:
./external/vendor-rust.sh

# It is important that cargo is executed from `src/rust` so that it loads the
# configuration for the vendored dependencies.
bitbox03-boot0:
(cd src/rust; cargo bitbox03-boot0-stm32u5a9j-dk)
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-boot0
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-boot0
bitbox03-boot0-release:
(cd src/rust; cargo bitbox03-boot0-stm32u5a9j-dk-release)
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-boot0
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-boot0
bitbox03-boot1:
(cd src/rust; cargo bitbox03-boot1-stm32u5a9j-dk)
python3 scripts/bitbox03_image_header.py finalize-elf src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-boot1
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-boot1
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-boot1
bitbox03-boot1-release:
(cd src/rust; cargo bitbox03-boot1-stm32u5a9j-dk-release)
python3 scripts/bitbox03_image_header.py finalize-elf src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-boot1
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-boot1
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-boot1
bitbox03-factorysetup:
(cd src/rust; cargo bitbox03-factorysetup-stm32u5a9j-dk)
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-factorysetup
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-factorysetup
bitbox03-factorysetup-release:
(cd src/rust; cargo bitbox03-factorysetup-stm32u5a9j-dk-release)
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-factorysetup
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-factorysetup
bitbox03-firmware:
(cd src/rust; cargo bitbox03-firmware-stm32u5a9j-dk)
python3 scripts/bitbox03_image_header.py finalize-elf src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-firmware
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-firmware
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/debug/bitbox03-firmware
bitbox03-firmware-release:
(cd src/rust; cargo bitbox03-firmware-stm32u5a9j-dk-release)
python3 scripts/bitbox03_image_header.py finalize-elf src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-firmware
arm-none-eabi-size src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-firmware
arm-none-eabi-size -Ax src/rust/target/thumbv8m.main-none-eabihf/release/bitbox03-firmware

flash-bitbox03-boot0-openocd:
./scripts/flash-bitbox03-boot0-openocd.sh
flash-bitbox03-boot1-openocd:
./scripts/flash-bitbox03-boot1-openocd.sh
Loading
Loading