Put the implicit memory.x behind a memory_x feature on embassy-stm32.

This commit is contained in:
Bob McWhirter 2021-08-02 13:21:30 -04:00
parent 3a00a1dba7
commit 5f9447abb4
7 changed files with 19 additions and 3 deletions

View file

@ -42,6 +42,7 @@ defmt-warn = [ ]
defmt-error = [ ]
sdmmc-rs = ["embedded-sdmmc"]
net = ["embassy-net", "vcell"]
memory_x = ["stm32-metapac/memory_x"]
# Reexport stm32-metapac at `embassy_stm32::pac`.
# This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version.

View file

@ -19,7 +19,7 @@ defmt-error = []
[dependencies]
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi", "unstable-pac"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi", "unstable-pac", "memory_x"] }
embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
defmt = "0.2.0"

View file

@ -19,7 +19,7 @@ defmt-error = []
[dependencies]
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32h743zi", "net"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32h743zi", "net", "memory_x"] }
embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] }
stm32-metapac = { path = "../../stm32-metapac", features = ["stm32h743zi"] }

View file

@ -17,6 +17,11 @@ fn main() {
//.write_all(include_bytes!("memory.x"))
//.unwrap();
println!("HOWDY");
#[cfg(feature = "memory_x")]
println!("cargo:rustc-link-search=src/chips/{}/memory_x/", _chip_name);
#[cfg(feature = "rt")]
println!("cargo:rustc-link-search=src/chips/{}", _chip_name);

View file

@ -773,7 +773,8 @@ fn gen_memory_x(out_dir: &PathBuf, chip: &Chip) {
write!(memory_x, " RAM : ORIGIN = 0x{:x}, LENGTH = {}\n", ram_origin, ram_bytes).unwrap();
write!(memory_x, "}}").unwrap();
let mut file = File::create(out_dir.join("memory.x")).unwrap();
fs::create_dir_all(out_dir.join("memory_x")).unwrap();
let mut file = File::create(out_dir.join("memory_x").join("memory.x")).unwrap();
file.write_all( memory_x.as_bytes() ).unwrap();
}

View file

@ -17,6 +17,7 @@ regex = "1.5.4"
[features]
rt = ["cortex-m-rt/device"]
memory_x = []
# BEGIN GENERATED FEATURES
# Generated by gen_features.py. DO NOT EDIT.

View file

@ -27,5 +27,13 @@ fn main() {
out_dir.display(),
chip_name.to_ascii_lowercase()
);
#[cfg(feature = "memory_x")]
println!(
"cargo:rustc-link-search={}/src/chips/{}/memory_x/",
out_dir.display(),
chip_name.to_ascii_lowercase()
);
println!("cargo:rerun-if-changed=build.rs");
}