Add NVIC_PRIO_BITS to data and metapac

This commit is contained in:
JackN 2023-03-22 14:18:37 -04:00
parent e208ba72b6
commit 9c8ef4b931
6 changed files with 12 additions and 1 deletions

View File

@ -691,6 +691,10 @@ fn process_core(
want_nvic_name
};
let chip_nvic = group.ips.values().find(|x| x.name == want_nvic_name).unwrap();
// With the current data sources, this value is always either 2 or 4, and never unwraps to None(0)
let nvic_priority_bits = *(defines.0.get("__NVIC_PRIO_BITS").unwrap_or(&0)) as u8;
let mut header_irqs = h.interrupts.get(core_name).unwrap().clone();
let chip_irqs = chip_interrupts
.0
@ -963,6 +967,7 @@ fn process_core(
stm32_data_serde::chip::Core {
name: real_core_name.clone(),
peripherals,
nvic_priority_bits,
interrupts,
dma_channels: core_dma_channels,
}

View File

@ -62,6 +62,7 @@ pub mod chip {
pub struct Core {
pub name: String,
pub peripherals: Vec<core::Peripheral>,
pub nvic_priority_bits: u8,
pub interrupts: Vec<core::Interrupt>,
pub dma_channels: Vec<core::DmaChannels>,
}

View File

@ -1,6 +1,6 @@
[package]
name = "stm32-metapac"
version = "0.1.0"
version = "1.0.0"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/embassy-rs/stm32-data"

View File

@ -5,6 +5,7 @@ pub struct Metadata {
pub line: &'static str,
pub memory: &'static [MemoryRegion],
pub peripherals: &'static [Peripheral],
pub nvic_priority_bits: u8,
pub interrupts: &'static [Interrupt],
pub dma_channels: &'static [DmaChannel],
}

View File

@ -38,6 +38,7 @@ pub enum MemoryRegionKind {
pub struct Core {
pub name: String,
pub peripherals: Vec<Peripheral>,
pub nvic_priority_bits: u8,
pub interrupts: Vec<Interrupt>,
pub dma_channels: Vec<DmaChannel>,
}

View File

@ -50,6 +50,7 @@ impl Gen {
let mut ir = ir::IR::new();
let mut dev = ir::Device {
nvic_priority_bits: core.nvic_priority_bits,
interrupts: Vec::new(),
peripherals: Vec::new(),
};
@ -194,6 +195,7 @@ impl Gen {
line: {:?},
memory: {},
peripherals: PERIPHERALS,
nvic_priority_bits: {},
interrupts: INTERRUPTS,
dma_channels: DMA_CHANNELS,
}};",
@ -202,6 +204,7 @@ impl Gen {
&chip.family,
&chip.line,
stringify(&chip.memory),
&core.nvic_priority_bits,
);
let mut file = File::create(chip_dir.join("metadata.rs")).unwrap();