From 8f130c11973f91467a52da72db8af0bf5b861abd Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 15 May 2024 15:14:17 +0200 Subject: [PATCH 1/3] Move cargo profile configuration to Cargo.toml According to the Cargo book, profiles should be defined in `Cargo.toml` (https://doc.rust-lang.org/cargo/reference/profiles.html). --- .cargo/config | 8 -------- Cargo.toml | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.cargo/config b/.cargo/config index fa95820..64c93b1 100644 --- a/.cargo/config +++ b/.cargo/config @@ -7,11 +7,3 @@ rustflags = [ [build] target = "riscv32imac-unknown-none-elf" - -[profile.release] -opt-level = "z" # Optimize for size. -codegen-units = 1 -lto = true - -[profile.dev] -opt-level = "z" # Optimize for size. diff --git a/Cargo.toml b/Cargo.toml index 97f80d9..6500fd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,3 +44,10 @@ required-features = ["lcd"] name = "sdcard_test" required-features = ["sdcard"] +[profile.release] +opt-level = "z" # Optimize for size. +codegen-units = 1 +lto = true + +[profile.dev] +opt-level = "z" # Optimize for size. From bfc07bb86dd993dc10ac648cfa70e830bbfeaeb9 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 15 May 2024 15:16:20 +0200 Subject: [PATCH 2/3] Rename .cargo/config.toml When building the project, Cargo raises a warning about `.cargo/config` being deprecated in favor of `config.toml`. This commit drops compatibility with Cargo 1.38 or ealier (09-2019). --- .cargo/{config => config.toml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .cargo/{config => config.toml} (100%) diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml From e2d40e9f0e9539887739765366749c33013afd7c Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 15 May 2024 15:22:56 +0200 Subject: [PATCH 3/3] README: update .cargo/config.toml paths --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8657a23..987c20c 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ It will provide the `binutils/objcopy` tool needed to convert the compiled Rust ### Building -If you have a GD32VF103C**B** chip on your board, edit `.cargo/config` and replace +If you have a GD32VF103C**B** chip on your board, edit `.cargo/config.toml` and replace `memory-c8.x` with `memory-cb.x`. To build all the provided examples run @@ -179,7 +179,7 @@ To flash the firmware, execute `load` in GDB: ``` To improve your workflow, you can put the aforementioned GDB commands in -a `debug.gdb` file and add these lines to `.cargo/config`: +a `debug.gdb` file and add these lines to `.cargo/config.toml`: ``` [target.riscv32imac-unknown-none-elf]