feat: add linker stuff properly but it does not work

This commit is contained in:
cscherr 2025-04-17 16:41:03 +02:00
parent d108d90cdb
commit 861ad38191
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7
2 changed files with 19 additions and 0 deletions

View file

@ -14,7 +14,9 @@ hal = { package = "stm32l0xx-hal", version = "0.10.0", features = [
"stm32l0x3", "stm32l0x3",
"flash-192", "flash-192",
"ram-20", "ram-20",
"io-STM32L051",
# "mcu-STM32L053R8", # does not exist in that crate # "mcu-STM32L053R8", # does not exist in that crate
"disable-linker-script",
] } ] }
[[bin]] [[bin]]

17
build.rs Executable file
View file

@ -0,0 +1,17 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=memory.x");
}