aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob McWhirter <[email protected]>2021-08-02 13:21:30 -0400
committerBob McWhirter <[email protected]>2021-08-02 13:21:30 -0400
commit5f9447abb4463a9659a184b3b62bc2da3a696096 (patch)
tree0be9578300df95216ce9c0f3bf24961b00abc30b
parent3a00a1dba7846f2c2639e35cc85490b2fbe8a0d9 (diff)
Put the implicit memory.x behind a `memory_x` feature on embassy-stm32.
-rw-r--r--embassy-stm32/Cargo.toml1
-rw-r--r--examples/stm32f4/Cargo.toml2
-rw-r--r--examples/stm32h7/Cargo.toml2
-rw-r--r--stm32-metapac-gen/src/assets/build.rs5
-rw-r--r--stm32-metapac-gen/src/lib.rs3
-rw-r--r--stm32-metapac/Cargo.toml1
-rw-r--r--stm32-metapac/build.rs8
7 files changed, 19 insertions, 3 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index d94c9d523..65592b1d9 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -42,6 +42,7 @@ defmt-warn = [ ]
42defmt-error = [ ] 42defmt-error = [ ]
43sdmmc-rs = ["embedded-sdmmc"] 43sdmmc-rs = ["embedded-sdmmc"]
44net = ["embassy-net", "vcell"] 44net = ["embassy-net", "vcell"]
45memory_x = ["stm32-metapac/memory_x"]
45 46
46# Reexport stm32-metapac at `embassy_stm32::pac`. 47# Reexport stm32-metapac at `embassy_stm32::pac`.
47# This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version. 48# 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 693dac545..eb88ecc1c 100644
--- a/examples/stm32f4/Cargo.toml
+++ b/examples/stm32f4/Cargo.toml
@@ -19,7 +19,7 @@ defmt-error = []
19[dependencies] 19[dependencies]
20embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } 20embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
21embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } 21embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
22embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi", "unstable-pac"] } 22embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi", "unstable-pac", "memory_x"] }
23embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } 23embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
24 24
25defmt = "0.2.0" 25defmt = "0.2.0"
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 278ab6f6b..081e45a69 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -19,7 +19,7 @@ defmt-error = []
19[dependencies] 19[dependencies]
20embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] } 20embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "defmt-trace"] }
21embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } 21embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
22embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32h743zi", "net"] } 22embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "defmt-trace", "stm32h743zi", "net", "memory_x"] }
23embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } 23embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
24embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] } 24embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt-debug", "defmt", "tcp", "medium-ethernet", "pool-16"] }
25stm32-metapac = { path = "../../stm32-metapac", features = ["stm32h743zi"] } 25stm32-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 13050315e..0fe7c65e9 100644
--- a/stm32-metapac-gen/src/assets/build.rs
+++ b/stm32-metapac-gen/src/assets/build.rs
@@ -17,6 +17,11 @@ fn main() {
17 //.write_all(include_bytes!("memory.x")) 17 //.write_all(include_bytes!("memory.x"))
18 //.unwrap(); 18 //.unwrap();
19 19
20 println!("HOWDY");
21
22 #[cfg(feature = "memory_x")]
23 println!("cargo:rustc-link-search=src/chips/{}/memory_x/", _chip_name);
24
20 #[cfg(feature = "rt")] 25 #[cfg(feature = "rt")]
21 println!("cargo:rustc-link-search=src/chips/{}", _chip_name); 26 println!("cargo:rustc-link-search=src/chips/{}", _chip_name);
22 27
diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs
index e63c35ecd..5e0cc58d4 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) {
773 write!(memory_x, " RAM : ORIGIN = 0x{:x}, LENGTH = {}\n", ram_origin, ram_bytes).unwrap(); 773 write!(memory_x, " RAM : ORIGIN = 0x{:x}, LENGTH = {}\n", ram_origin, ram_bytes).unwrap();
774 write!(memory_x, "}}").unwrap(); 774 write!(memory_x, "}}").unwrap();
775 775
776 let mut file = File::create(out_dir.join("memory.x")).unwrap(); 776 fs::create_dir_all(out_dir.join("memory_x")).unwrap();
777 let mut file = File::create(out_dir.join("memory_x").join("memory.x")).unwrap();
777 file.write_all( memory_x.as_bytes() ).unwrap(); 778 file.write_all( memory_x.as_bytes() ).unwrap();
778 779
779} 780}
diff --git a/stm32-metapac/Cargo.toml b/stm32-metapac/Cargo.toml
index 2e01d5183..692acd8a8 100644
--- a/stm32-metapac/Cargo.toml
+++ b/stm32-metapac/Cargo.toml
@@ -17,6 +17,7 @@ regex = "1.5.4"
17 17
18[features] 18[features]
19rt = ["cortex-m-rt/device"] 19rt = ["cortex-m-rt/device"]
20memory_x = []
20 21
21# BEGIN GENERATED FEATURES 22# BEGIN GENERATED FEATURES
22# Generated by gen_features.py. DO NOT EDIT. 23# Generated by gen_features.py. DO NOT EDIT.
diff --git a/stm32-metapac/build.rs b/stm32-metapac/build.rs
index b44d98f3a..d922735a1 100644
--- a/stm32-metapac/build.rs
+++ b/stm32-metapac/build.rs
@@ -27,5 +27,13 @@ fn main() {
27 out_dir.display(), 27 out_dir.display(),
28 chip_name.to_ascii_lowercase() 28 chip_name.to_ascii_lowercase()
29 ); 29 );
30
31 #[cfg(feature = "memory_x")]
32 println!(
33 "cargo:rustc-link-search={}/src/chips/{}/memory_x/",
34 out_dir.display(),
35 chip_name.to_ascii_lowercase()
36 );
37
30 println!("cargo:rerun-if-changed=build.rs"); 38 println!("cargo:rerun-if-changed=build.rs");
31} 39}