nucleo-l053r8-benches/crates/algorithms/algorithms-c/README.md
2025-07-31 16:53:01 +02:00

27 lines
1.2 KiB
Markdown
Executable file

# Algorithms-c
This subproject contains all C Code for the benchmarking. It is built with
[ceedling](https://www.throwtheswitch.org/ceedling), a more modern build tool
for C projects that also integrates well with the Unity framework.
## Compiler
To compile for STM32, you need to crosscompile
```
# apt install binutils-arm-none-eabi gcc-arm-none-eabi
```
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)
. You can and should also give extra compiler flags in `$CC_FLAGS`.
```bash
# 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 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.