Skip to content

Commit cdd0f8e

Browse files
committed
Exclude stm32wb55 sram2 from memory.x
1 parent 3eab5e1 commit cdd0f8e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

stm32-metapac-gen/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ fn get_memory_range(chip: &Chip, kind: MemoryRegionKind) -> (u32, u32, String) {
463463
let mut names = Vec::new();
464464
let mut best: Option<(u32, u32, String)> = None;
465465
for m in mems {
466+
if !mem_filter(&chip.name, &m.name) {
467+
continue;
468+
}
469+
466470
if m.address != end {
467471
names = Vec::new();
468472
start = m.address;
@@ -480,6 +484,19 @@ fn get_memory_range(chip: &Chip, kind: MemoryRegionKind) -> (u32, u32, String) {
480484
best.unwrap()
481485
}
482486

487+
fn mem_filter(chip: &str, region: &str) -> bool {
488+
// in STM32WB, SRAM2a/SRAM2b are reserved for the radio core.
489+
if chip.starts_with("STM32WB")
490+
&& !chip.starts_with("STM32WBA")
491+
&& !chip.starts_with("STM32WB0")
492+
&& region.starts_with("SRAM2")
493+
{
494+
return false;
495+
}
496+
497+
true
498+
}
499+
483500
fn gen_all_chips(chips: &[String]) -> String {
484501
let mut contents = String::new();
485502
writeln!(&mut contents, "pub static ALL_CHIPS: &[&str] = &[").unwrap();

0 commit comments

Comments
 (0)