Skip to content

Commit d445db7

Browse files
committed
Merge branch 'nickez/simulator-winit'
2 parents 4eb8533 + 16e5829 commit d445db7

40 files changed

+5126
-53
lines changed

.github/workflows/ci-common.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ jobs:
201201
- factory-setup
202202
- firmware-debug
203203
- simulator
204+
- simulator-graphical
204205
runs-on: ubuntu-22.04
205206
container:
206207
image: ${{ inputs.container-repo }}:${{ inputs.container-version }}

BUILD.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,22 @@ make bootloader
161161
162162
### Build the simulator
163163

164-
The Multi edition firmware can be built as a simulator for linux-amd64. To build it, run:
164+
The Multi edition firmware can be built as a simulator for linux and macos. To
165+
build it, run:
165166

166167
```sh
167168
make simulator
168169
```
169170

171+
### Build the graphical simulator
172+
173+
The Multi edition firmware can be built as a graphical simulator for linux and
174+
macos. To build it, run:
175+
176+
```sh
177+
make simulator-graphical
178+
```
179+
170180
### Flash instructions
171181

172182
#### Connect J-Link probe
@@ -236,17 +246,28 @@ To view the results, open `build/docs/html/index.html` in a web browser.
236246
Run it with:
237247

238248
```sh
239-
./build-build/bin/simulator
249+
./build-build-noasan/bin/simulator
240250
```
241251

242-
This launches a server simulating the firmware. The send_message tool can connect to it with:
252+
or the following if you built the graphical one:
253+
254+
```sh
255+
./build-build-noasan/bin/simulator-graphical --preseed
256+
```
257+
258+
This launches a server simulating the firmware. The send_message tool can
259+
connect to it with:
243260

244261
./py/send_message.py --simulator
245262

246-
If you choose to create a wallet by restoring a mnemonic, the simulator will automatically use this
247-
mnemonic:
263+
Both simulators can load the following seed:
264+
265+
boring mistake dish oyster truth pigeon viable emerge sort crash wire
266+
portion cannon couple enact box walk height pull today solid off enable
267+
tide
248268

249-
boring mistake dish oyster truth pigeon viable emerge sort crash wire portion cannon couple enact box walk height pull today solid off enable tide
269+
The graphical simulator does it with the flag `--preseed`. The original
270+
simulator loads it if you restore from mnemonic.
250271

251272

252273
#### Debugging using the J-Link probe and GDB

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
88

99
### [Unreleased]
1010
- Fix bug that BLE was turned off when iOS device is unlocked
11+
- simulator-graphical: a new simulator with a graphical user interface
1112

1213
### v9.24.0
1314
- Change title when entering recovery words to `1 of 24`, `2 of 24`, etc.

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ else()
369369
include(CTest)
370370
add_subdirectory(test/unit-test)
371371
add_subdirectory(test/simulator)
372+
add_subdirectory(test/simulator-graphical)
372373
if(COVERAGE)
373374
find_program(GCOVR gcovr)
374375
if(NOT GCOVR STREQUAL "GCOVR-NOTFOUND")

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ rust-docs: | build
108108
$(MAKE) -C build rust-docs
109109
simulator: | build-build-noasan
110110
$(MAKE) -C build-build-noasan simulator
111+
simulator-graphical: | build-build-noasan
112+
$(MAKE) -C build-build-noasan simulator-graphical
111113
run-simulator: | simulator
112114
./build-build-noasan/bin/simulator
113115
unit-test: | build-build
@@ -189,3 +191,7 @@ prepare-tidy: | build build-build
189191
$(MAKE) -C build-build rust-cbindgen
190192
clean:
191193
rm -rf build build-build build-debug build-build-noasan
194+
195+
# When you vendor rust libs avoid duplicates
196+
vendor-rust-deps:
197+
(cd external; ./vendor-rust.sh)

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ messages. The encryption protocol used is Noise with out-of-band authentication.
5959
The instructions for setting up a development environment can be found in [BUILD.md](BUILD.md).
6060
Please also read our [CONTRIBUTING.md](CONTRIBUTING.md) before filing issues and pull requests.
6161

62+
### Simulator
63+
64+
To test without hardware there are two kinds of simulators. One with GUI and
65+
one without. See more details in [BUILD.md](BUILD.md#build-the-simulator).
66+
67+
<p align="center"><img src="./doc/bb02-simulator-graphical.png" /></p>
68+
69+
6270
## Installing/upgrading firmware
6371

6472
There are two main ways to install or upgrade firmware on a BitBox02:

doc/bb02-simulator-graphical.png

163 KB
Loading

.cargo/config.toml renamed to src/rust/.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ branch = "bitbox-20250922"
1717
replace-with = "vendored-sources"
1818

1919
[source.vendored-sources]
20-
directory = "external/vendor"
20+
directory = "../../external/vendor"

src/rust/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,16 @@ We generate one header file `rust.h` and ever product specific function is `#ifd
3838

3939
# Vendoring
4040

41-
Run the vendoring script `vendor.sh` to vendor dependencies from crates.io. The
42-
script will ensure that also rust std libs dependencies are vendored.
41+
Run the vendoring script `vendor-rust.sh` to vendor dependencies from
42+
crates.io. The script will ensure that also rust std libs dependencies are
43+
vendored.
44+
45+
When the toolchain (and standard libraries) are updated they usually depend on
46+
newer versions of crates. Update our lockfile to the same versions to avoid
47+
vendoringing duplicate versions. You can use:
48+
49+
```
50+
cargo update <package> --precise <version>
51+
```
52+
53+
to specify specific versions to up/downgrade to.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ testing = ["bitbox02-rust/testing", "bitbox02/testing"]
9090
# Active when the Rust code is compiled to be linked into the C unit tests and simulator.
9191
c-unit-testing = ["bitbox02-rust/c-unit-testing", "bitbox02/c-unit-testing", "util/c-unit-testing"]
9292

93+
simulator-graphical = [
94+
"app-bitcoin",
95+
"app-litecoin",
96+
"app-ethereum",
97+
"app-cardano",
98+
"firmware",
99+
]
100+
93101
app-ethereum = [
94102
# enable this feature in the deps
95103
"bitbox02-rust/app-ethereum",

0 commit comments

Comments
 (0)