Skip to content

Commit

Permalink
hashes/embedded: Add script dir and README
Browse files Browse the repository at this point in the history
To help folk work out how to run the `hashes/embedded` test crate copy
over the `script` directory and an updated version of the `README` from
`embedded/bitcoin`.
  • Loading branch information
tcharding committed Jul 18, 2023
1 parent 94732ae commit 5b1443a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions hashes/embedded/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Running

To run the embedded test, first prepare your environment:

```shell
sudo ./scripts/install-deps
rustup +nightly target add thumbv7m-none-eabi
```

Then:

```shell
source ./scripts/env.sh && cargo +nightly run --target thumbv7m-none-eabi
```

Output should be something like:

```text
hash:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad hash_check:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
hash:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad hash_check:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
```

## Cleanup

After sourcing `scripts/env.sh` and _before_ building again using another target
you'll want to unset `RUSTFLAGS` otherwise you'll get linker errors.

```shell
unset RUSTFLAGS
```
2 changes: 2 additions & 0 deletions hashes/embedded/scripts/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export RUSTFLAGS="-C link-arg=-Tlink.x"
export CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER="qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
3 changes: 3 additions & 0 deletions hashes/embedded/scripts/install-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

apt install gcc-arm-none-eabi qemu-system-arm gdb-multiarch

0 comments on commit 5b1443a

Please sign in to comment.