hashes/embedded: Add script dir and README

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`.
This commit is contained in:
Tobin C. Harding 2023-06-28 14:48:17 +10:00
parent 94732aecbf
commit 5b1443a91c
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 35 additions and 0 deletions

30
hashes/embedded/README.md Normal file
View File

@ -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
```

View File

@ -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"

View File

@ -0,0 +1,3 @@
#!/bin/sh
apt install gcc-arm-none-eabi qemu-system-arm gdb-multiarch