Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions svd-encoder/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- Pin `indexmap` to `2.11.4` to support our MSRV

## [v0.14.7] - 2025-03-11

- Bump MSRV to 1.70.0
Expand Down
3 changes: 3 additions & 0 deletions svd-encoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ readme = "README.md"
convert_case = "0.6.0"
svd-rs = { version = "0.14.12", path = "../svd-rs" }
thiserror = "1.0.31"
# This is a transitive dep introduced by XML tree,
# but we need to pin to this version to support our current MSRV of 1.70.0
indexmap = "=2.11.4"

[dependencies.xmltree]
version = "0.11.0"
Expand Down
2 changes: 2 additions & 0 deletions svd-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- Add `Target` enum to `Config` and make `vendorSystickConfig` only required for ARM.

## [v0.14.9] - 2025-03-11

- Bump MSRV to 1.70.0
Expand Down
10 changes: 9 additions & 1 deletion svd-parser/src/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ impl Parse for Cpu {
return Err(SVDError::NotExpectedTag("cpu".to_string()).at(tree.id()));
}

// Vendor systick is required by ARM targets, but not others
// So for others we just default to false if not provided
let has_vendor_systick = match tree.get_child_bool("vendorSystickConfig") {
Ok(v) => v,
Err(e) if config.target == Target::CortexM => return Err(e),
_ => false,
};

Cpu::builder()
.name(tree.get_child_text("name")?)
.revision(tree.get_child_text("revision")?)
Expand All @@ -26,7 +34,7 @@ impl Parse for Cpu {
.dtcm_present(optional::<BoolParse>("dtcmPresent", tree, &())?)
.vtor_present(optional::<BoolParse>("vtorPresent", tree, &())?)
.nvic_priority_bits(tree.get_child_u32("nvicPrioBits")?)
.has_vendor_systick(tree.get_child_bool("vendorSystickConfig")?)
.has_vendor_systick(has_vendor_systick)
.device_num_interrupts(optional::<u32>("deviceNumInterrupts", tree, &())?)
.sau_num_regions(optional::<u32>("sauNumRegions", tree, &())?)
.build(config.validate_level)
Expand Down
22 changes: 22 additions & 0 deletions svd-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub mod types;
#[non_exhaustive]
/// Advanced parser options
pub struct Config {
/// CPU target architecture
pub target: Target,
/// SVD error check level
pub validate_level: ValidateLevel,
#[cfg(feature = "expand")]
Expand Down Expand Up @@ -80,6 +82,26 @@ impl Config {
}
}

#[allow(clippy::upper_case_acronyms)]
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
/// CPU target architecture
pub enum Target {
#[default]
/// ARM Cortex-M
CortexM,
/// Texas Instruments MSP430
Msp430,
/// RISC-V
RISCV,
/// Xtensa LX
XtensaLX,
/// MIPS
Mips,
/// None specified
None,
}

/// Parse trait allows SVD objects to be parsed from XML elements.
pub trait Parse {
/// Object returned by parse method
Expand Down