small tweaks

This commit is contained in:
Robin Mueller
2026-09-24 19:36:54 +02:00
parent 820b554407
commit 72f9eaff9a
4 changed files with 40 additions and 7 deletions
@@ -0,0 +1,29 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-rs run --chip STM32H753ZITx"
# runner = ["probe-rs", "run", "--chip", "$CHIP", "--log-format", "{L} {s}"]
rustflags = [
"-C", "linker=flip-link",
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x",
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
"-C", "link-arg=--nmagic",
# Can be useful for debugging.
# "-Clink-args=-Map=app.map"
]
[build]
# (`thumbv6m-*` is compatible with all ARM Cortex-M chips but using the right
# target improves performance)
# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
# target = "thumbv7m-none-eabi" # Cortex-M3
# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
[alias]
rb = "run --bin"
rrb = "run --release --bin"
[env]
DEFMT_LOG = "info"
@@ -1,4 +1,4 @@
/target
/.cargo/config*
/.cargo/config.toml
/.vscode
/app.map
@@ -29,15 +29,19 @@ If you have not installed it yet, you can do so with
rustup target add thumbv7em-none-eabihf
```
A default `.cargo` config file is provided for this project, but needs to be copied to have
the correct name. This is so that the config file can be updated or edited for custom needs
without being tracked by git.
A default `.cargo` config file is provided as `.cargo/config.toml.template`. The build script
copies it to `.cargo/config.toml` if that file does not exist yet. The copy is not tracked by git,
so you can change settings like the runner for your setup.
Cargo reads the configuration before the build script runs, so the very first build on a fresh
checkout does not use it yet and might fail. Simply run the build again, or copy the file
manually beforehand:
```sh
cp def_config.toml config.toml
cp .cargo/config.toml.template .cargo/config.toml
```
The configuration file will also set the target so it does not always have to be specified with
The configuration file also sets the target so it does not always have to be specified with
the `--target` argument.
## Building
@@ -3,7 +3,7 @@ use std::{env, fs};
fn main() {
let manifest_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let cargo_dir = manifest_dir.parent().unwrap().join(".cargo");
let cargo_dir = manifest_dir.join(".cargo");
let config = cargo_dir.join("config.toml");
let config_template = cargo_dir.join("config.toml.template");