diff options
| author | Taylor Carpenter <[email protected]> | 2024-02-01 10:41:41 -0500 |
|---|---|---|
| committer | Taylor Carpenter <[email protected]> | 2024-02-01 10:41:41 -0500 |
| commit | 72ca5a022b44fe621fbae52a33ac7e45b9cc66a2 (patch) | |
| tree | 25918564ea5aa7f213c13ce2506cc11b92e83cc6 | |
| parent | 9cd0beaee37f9e1cc885ad162b63bca795478227 (diff) | |
Add scatter memory files for extended BLE stack
Build script chooses the 'x.in' to copy over to 'tl_mbox.x' based on features
| -rw-r--r-- | embassy-stm32-wpan/Cargo.toml | 2 | ||||
| -rw-r--r-- | embassy-stm32-wpan/build.rs | 17 | ||||
| -rw-r--r-- | embassy-stm32-wpan/tl_mbox_extended_wb1.x.in | 16 | ||||
| -rw-r--r-- | embassy-stm32-wpan/tl_mbox_extended_wbx5.x.in | 16 |
4 files changed, 49 insertions, 2 deletions
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml index 4f53a400a..360ca5f4b 100644 --- a/embassy-stm32-wpan/Cargo.toml +++ b/embassy-stm32-wpan/Cargo.toml | |||
| @@ -44,6 +44,8 @@ defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embas | |||
| 44 | ble = ["dep:stm32wb-hci"] | 44 | ble = ["dep:stm32wb-hci"] |
| 45 | mac = ["dep:bitflags", "dep:embassy-net-driver" ] | 45 | mac = ["dep:bitflags", "dep:embassy-net-driver" ] |
| 46 | 46 | ||
| 47 | extended = [] | ||
| 48 | |||
| 47 | stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ] | 49 | stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ] |
| 48 | stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ] | 50 | stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ] |
| 49 | stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ] | 51 | stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ] |
diff --git a/embassy-stm32-wpan/build.rs b/embassy-stm32-wpan/build.rs index 94aac070d..7ab458bf2 100644 --- a/embassy-stm32-wpan/build.rs +++ b/embassy-stm32-wpan/build.rs | |||
| @@ -18,9 +18,22 @@ fn main() { | |||
| 18 | // stm32wb tl_mbox link sections | 18 | // stm32wb tl_mbox link sections |
| 19 | 19 | ||
| 20 | let out_file = out_dir.join("tl_mbox.x").to_string_lossy().to_string(); | 20 | let out_file = out_dir.join("tl_mbox.x").to_string_lossy().to_string(); |
| 21 | fs::write(out_file, fs::read_to_string("tl_mbox.x.in").unwrap()).unwrap(); | 21 | let in_file; |
| 22 | if env::var_os("CARGO_FEATURE_EXTENDED").is_some() { | ||
| 23 | if env::vars() | ||
| 24 | .map(|(a, _)| a) | ||
| 25 | .any(|x| x.starts_with("CARGO_FEATURE_STM32WB1")) | ||
| 26 | { | ||
| 27 | in_file = "tl_mbox_extended_wb1.x.in"; | ||
| 28 | } else { | ||
| 29 | in_file = "tl_mbox_extended_wbx5.x.in"; | ||
| 30 | } | ||
| 31 | } else { | ||
| 32 | in_file = "tl_mbox.x.in"; | ||
| 33 | } | ||
| 34 | fs::write(out_file, fs::read_to_string(in_file).unwrap()).unwrap(); | ||
| 22 | println!("cargo:rustc-link-search={}", out_dir.display()); | 35 | println!("cargo:rustc-link-search={}", out_dir.display()); |
| 23 | println!("cargo:rerun-if-changed=tl_mbox.x.in"); | 36 | println!("cargo:rerun-if-changed={}", in_file); |
| 24 | } | 37 | } |
| 25 | 38 | ||
| 26 | enum GetOneError { | 39 | enum GetOneError { |
diff --git a/embassy-stm32-wpan/tl_mbox_extended_wb1.x.in b/embassy-stm32-wpan/tl_mbox_extended_wb1.x.in new file mode 100644 index 000000000..4cffdaddd --- /dev/null +++ b/embassy-stm32-wpan/tl_mbox_extended_wb1.x.in | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 4K | ||
| 4 | RAMB_SHARED (xrw) : ORIGIN = 0x20030028, LENGTH = 4K | ||
| 5 | } | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Scatter the mailbox interface memory sections in shared memory | ||
| 9 | */ | ||
| 10 | SECTIONS | ||
| 11 | { | ||
| 12 | TL_REF_TABLE (NOLOAD) : { *(TL_REF_TABLE) } >RAM_SHARED | ||
| 13 | |||
| 14 | MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAMB_SHARED | ||
| 15 | MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAMB_SHARED | ||
| 16 | } | ||
diff --git a/embassy-stm32-wpan/tl_mbox_extended_wbx5.x.in b/embassy-stm32-wpan/tl_mbox_extended_wbx5.x.in new file mode 100644 index 000000000..281d637a9 --- /dev/null +++ b/embassy-stm32-wpan/tl_mbox_extended_wbx5.x.in | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 2K | ||
| 4 | RAMB_SHARED (xrw) : ORIGIN = 0x20038000, LENGTH = 10K | ||
| 5 | } | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Scatter the mailbox interface memory sections in shared memory | ||
| 9 | */ | ||
| 10 | SECTIONS | ||
| 11 | { | ||
| 12 | TL_REF_TABLE (NOLOAD) : { *(TL_REF_TABLE) } >RAM_SHARED | ||
| 13 | |||
| 14 | MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAMB_SHARED | ||
| 15 | MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAMB_SHARED | ||
| 16 | } | ||
