diff options
-rw-r--r-- | embassy-stm32/Cargo.toml | 1 | ||||
-rw-r--r-- | examples/stm32f4/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/stm32h7/Cargo.toml | 2 | ||||
-rw-r--r-- | stm32-metapac-gen/src/assets/build.rs | 5 | ||||
-rw-r--r-- | stm32-metapac-gen/src/lib.rs | 3 | ||||
-rw-r--r-- | stm32-metapac/Cargo.toml | 1 | ||||
-rw-r--r-- | stm32-metapac/build.rs | 8 |
7 files changed, 19 insertions, 3 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index d94c9d52..65592b1d 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -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. diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml index 693dac54..eb88ecc1 100644 --- a/examples/stm32f4/Cargo.toml +++ b/examples/stm32f4/Cargo.toml @@ -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" diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml index 278ab6f6..081e45a6 100644 --- a/examples/stm32h7/Cargo.toml +++ b/examples/stm32h7/Cargo.toml @@ -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"] } diff --git a/stm32-metapac-gen/src/assets/build.rs b/stm32-metapac-gen/src/assets/build.rs index 13050315..0fe7c65e 100644 --- a/stm32-metapac-gen/src/assets/build.rs +++ b/stm32-metapac-gen/src/assets/build.rs @@ -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); diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs index e63c35ec..5e0cc58d 100644 --- a/stm32-metapac-gen/src/lib.rs +++ b/stm32-metapac-gen/src/lib.rs @@ -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(); } diff --git a/stm32-metapac/Cargo.toml b/stm32-metapac/Cargo.toml index 2e01d518..692acd8a 100644 --- a/stm32-metapac/Cargo.toml +++ b/stm32-metapac/Cargo.toml @@ -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. diff --git a/stm32-metapac/build.rs b/stm32-metapac/build.rs index b44d98f3..d922735a 100644 --- a/stm32-metapac/build.rs +++ b/stm32-metapac/build.rs @@ -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"); } |