Skip to content

Commit c2a0fa2

Browse files
committed
Change the memory type of the metadata
1 parent 39e7caa commit c2a0fa2

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

stm32-metapac-gen/res/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub struct Metadata {
126126
pub name: &'static str,
127127
pub family: &'static str,
128128
pub line: &'static str,
129-
pub memory: &'static [MemoryRegion],
129+
pub memory: &'static [&'static [MemoryRegion]],
130130
pub peripherals: &'static [Peripheral],
131131
pub nvic_priority_bits: Option<u8>,
132132
pub interrupts: &'static [Interrupt],

stm32-metapac-gen/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,26 +167,28 @@ impl Gen {
167167
file
168168
});
169169

170+
let memories = chip
171+
.memory
172+
.iter()
173+
.map(|memory| stringify(memory))
174+
.collect::<Vec<_>>()
175+
.join(",");
176+
170177
let data = format!(
171178
"include!(\"../{}\");
172179
use crate::metadata::PeripheralRccKernelClock::{{Clock, Mux}};
173180
pub static METADATA: Metadata = Metadata {{
174181
name: {:?},
175182
family: {:?},
176183
line: {:?},
177-
memory: {},
184+
memory: &[{}],
178185
peripherals: PERIPHERALS,
179186
nvic_priority_bits: {:?},
180187
interrupts: INTERRUPTS,
181188
dma_channels: DMA_CHANNELS,
182189
pins: PINS,
183190
}};",
184-
deduped_file,
185-
&chip.name,
186-
&chip.family,
187-
&chip.line,
188-
stringify(&chip.memory),
189-
&core.nvic_priority_bits,
191+
deduped_file, &chip.name, &chip.family, &chip.line, memories, &core.nvic_priority_bits,
190192
);
191193

192194
let mut file = File::create(chip_dir.join("metadata.rs")).unwrap();

0 commit comments

Comments
 (0)