docs: update readme

This commit is contained in:
cscherr 2025-07-31 16:53:01 +02:00
parent 92cdf6af78
commit f162fe8734
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7
2 changed files with 29 additions and 9 deletions

View file

@ -13,24 +13,43 @@ the prgrams are running.
## Building
See [./scripts/build.sh].
See [build.sh](./scripts/build.sh).
## Building
## Flashing
See [./scripts/build.sh].
See [flash.sh](./scripts/flash.sh).
## Host-Benchmarks
The algorithms have benchmarks that can run on regular consumer laptops, so that
you can see the implementation difference on a bigger architecture like
`x86_64`.
See [bench_algorithms.sh](./scripts/bench_algorithms.sh).
### Dependencies
This program requires Rust to be installed. I made it with `Rust 1.88.0`, but
the theoretical MSRV is `Rust 1.85.1` (according to `cargo-msrv`).
In addition to some crates from crates.io, this project requires the following
to be installed to compile and link to the algorithms-c implementations.
```
# on debian bookworm
apt install binutils-arm-none-eabi gcc-arm-none-eabi # compiler for the target architecture
apt install ruby # ceedling is the used build system for algorithms-c, and needs to be installed with gem, the ruby package manager
# compiler for your architecture if you want to run the unit tests
apt install gcc
# compiler for the target architecture
apt install binutils-arm-none-eabi gcc-arm-none-eabi
# ceedling is the used build system for algorithms-c, and needs to be installed with gem, the ruby package manager
apt install ruby
gem install ceedling
```
To actually flash the program onto an STM32, you also need
[probe-rs](https://probe.rs/docs/getting-started/installation/). I used
`probe-rs 0.29.1`.
## Acknowledgements
For implementing the SHA-2-256 Algorithm, [this](https://sha256algorithm.com/)

View file

@ -14,13 +14,14 @@ To compile for STM32, you need to crosscompile
Then, use your tool with an `arm-none-eabi-` prefix: `arm-none-eabi-gcc`. This
project has been configured to use the compiler specified in `$CC` to compile modules and `$AR` to
"link" the object files (this should be `ar` for a static library like this).
"link" the object files (this should be `ar` for a static library like this)
. You can and should also give extra compiler flags in `$CC_FLAGS`.
```bash
# compile for STM32
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar ceedling release
# cross-compile for STM32
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar CC_FLAGS="-march=armv6-m" ceedling release
# compile for this computer
CC=gcc AR=ar ceedling release
```
It is also critically important to define the `-march=ARCH` option when using `arm-none-eabi-gcc`, since the compiler will otherwise just assume a target architecture. In this case, it needs to be set to `armv6-m`, since the MPU is a `cortex-M0+`. This MPU does only support the thumb instructionset, not the ARM32 set.
It is critically important to define the `-march=ARCH` option when using `arm-none-eabi-gcc`, since the compiler will otherwise just assume a target architecture. In this case, it needs to be set to `armv6-m`, since the MPU is a `cortex-M0+`. This MPU does only support the thumb instruction-set, not the ARM32 set.