No description
Find a file
2025-07-31 16:53:01 +02:00
.cargo feat(alg): ffi for sha2 of algc 2025-07-18 10:32:11 +02:00
.vscode fix: can't call C code from the stm32 2025-07-14 15:48:26 +02:00
crates/algorithms docs: update readme 2025-07-31 16:53:01 +02:00
scripts refactor: clean up scripts 2025-07-31 16:25:37 +02:00
src feat: delays in bench.rs 2025-07-16 12:15:31 +02:00
.gitignore refactor: clean up scripts 2025-07-31 16:25:37 +02:00
build.rs chore: build and test shenanigans 2025-07-09 15:12:10 +02:00
Cargo.lock feat(alg): crc32sum 2025-07-22 14:10:34 +02:00
Cargo.toml docs: set author in Cargo.toml 2025-07-31 16:46:36 +02:00
README.md docs: update readme 2025-07-31 16:53:01 +02:00

NUCLEO L053R8 Benches

This repository contains code to measure the performance of embedded C and Rust code for an STM32 Microcontroller, specifically the STM32L053R on a NUCLEO-L053R evaluation board.

It implements a variety of algorithms in both C and Rust (crate/algorithms). These Algorithm programs are then executed by the executable program written in Rust. C code is called using Rust's FFI with manually implemented bindings. To measure the actual runtime of the algorithms, you need to attach an oscilluscope to the configured port of the board while the prgrams are running.

Building

See build.sh.

Flashing

See 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.

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
# 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. I used probe-rs 0.29.1.

Acknowledgements

For implementing the SHA-2-256 Algorithm, this website was very helpful.

The algorithms themselves are mostly reference implementation of various RFCs.