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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
[._]*.sw[a-p]
Cargo.lock
target
tests/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why tests directory was ignored?

Copy link
Contributor Author

@brainstorm brainstorm Dec 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻‍♂️ ... I guess that @burrbull was generating some files automatically and did not want to version them in the past? Can't see any reason to keep ignoring them now TBH, that's why I removed the dir from .gitignore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not my repo initially :)

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fix: produce error on 0-width fields
- Fix: error instead of panic when an array/cluster name is missing the `%s` placeholder
- [breaking-change] Add support for 64 addresses, register values, enum values and writeConstraints
- [breaking-change] Remove unproven flag

## [v0.9.0] - 2019-11-17

Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ readme = "README.md"

[features]
derive-from = []
unproven = []

[dependencies]
xmltree = "0.8"
anyhow = "1.0.19"
thiserror = "1.0.5"
rayon = "1.3.0"
once_cell = "1.3.1"
rayon = "1.5.0"
once_cell = "1.5.2"
regex = "1"

[dependencies.serde]
Expand Down
2 changes: 1 addition & 1 deletion cmsis-svd
Submodule cmsis-svd updated from 25cbf4 to e5db23
7 changes: 0 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

#![deny(warnings)]

#[cfg(feature = "unproven")]
use std::collections::HashMap;

use xmltree::Element;

// ElementExt extends XML elements with useful methods
Expand All @@ -41,9 +39,7 @@ use anyhow::Result;
pub mod parse;
use parse::Parse;
// Encode defines encoding interfaces
#[cfg(feature = "unproven")]
pub mod encode;
#[cfg(feature = "unproven")]
use encode::Encode;
// Types defines simple types and parse/encode implementations
pub mod types;
Expand All @@ -61,7 +57,6 @@ pub fn parse(xml: &str) -> Result<Device> {
}

/// Encodes a device object to an SVD (XML) string
#[cfg(feature = "unproven")]
pub fn encode(d: &Device) -> Result<String> {
let root = d.encode()?;
let mut wr = Vec::new();
Expand All @@ -79,7 +74,6 @@ fn trim_utf8_bom(s: &str) -> &str {
}

/// Helper to create new base xml elements
#[cfg(feature = "unproven")]
pub(crate) fn new_element(name: &str, text: Option<String>) -> Element {
Element {
prefix: None,
Expand All @@ -96,7 +90,6 @@ pub(crate) fn new_element(name: &str, text: Option<String>) -> Element {
/// Takes an array of (item, xml) pairs where the item implements
/// Parse and Encode and tests object encoding and decoding
#[cfg(test)]
#[cfg(feature = "unproven")]
pub fn run_test<
T: Parse<Error = anyhow::Error, Object = T>
+ Encode<Error = anyhow::Error>
Expand Down
4 changes: 0 additions & 4 deletions src/svd/access.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use xmltree::Element;

use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
#[cfg(feature = "unproven")]
use crate::new_element;
use crate::types::Parse;

Expand Down Expand Up @@ -36,7 +34,6 @@ impl Parse for Access {
}
}

#[cfg(feature = "unproven")]
impl Encode for Access {
type Error = anyhow::Error;

Expand All @@ -54,7 +51,6 @@ impl Encode for Access {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::run_test;
Expand Down
5 changes: 0 additions & 5 deletions src/svd/addressblock.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#[cfg(feature = "unproven")]
use std::collections::HashMap;

use crate::elementext::ElementExt;
use xmltree::Element;

use crate::types::Parse;

#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
#[cfg(feature = "unproven")]
use crate::new_element;

#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
Expand All @@ -33,7 +30,6 @@ impl Parse for AddressBlock {
}
}

#[cfg(feature = "unproven")]
impl Encode for AddressBlock {
type Error = anyhow::Error;

Expand All @@ -55,7 +51,6 @@ impl Encode for AddressBlock {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::run_test;
Expand Down
4 changes: 1 addition & 3 deletions src/svd/bitrange.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use xmltree::Element;

use crate::error::*;
#[cfg(feature = "unproven")]
use crate::new_element;
use crate::types::Parse;

Expand Down Expand Up @@ -120,7 +119,7 @@ impl Parse for BitRange {
})
}
}
#[cfg(feature = "unproven")]

impl BitRange {
// TODO: Encode method differs from Encode trait as it acts on a set of possible children, create an interface or decide how to better do this
pub fn encode(&self) -> Result<Vec<Element>> {
Expand All @@ -142,7 +141,6 @@ impl BitRange {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;

Expand Down
3 changes: 0 additions & 3 deletions src/svd/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmltree::Element;

use crate::types::Parse;

#[cfg(feature = "unproven")]
use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
use crate::svd::{clusterinfo::ClusterInfo, dimelement::DimElement};
Expand Down Expand Up @@ -55,7 +53,6 @@ impl Parse for Cluster {
}
}

#[cfg(feature = "unproven")]
impl Encode for Cluster {
type Error = anyhow::Error;

Expand Down
3 changes: 0 additions & 3 deletions src/svd/clusterinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmltree::Element;

use crate::types::Parse;

#[cfg(feature = "unproven")]
use crate::encode::{Encode, EncodeChildren};
#[cfg(feature = "unproven")]
use crate::new_element;

use crate::error::*;
Expand Down Expand Up @@ -153,7 +151,6 @@ impl ClusterInfo {
}
}

#[cfg(feature = "unproven")]
impl Encode for ClusterInfo {
type Error = anyhow::Error;

Expand Down
6 changes: 1 addition & 5 deletions src/svd/cpu.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#[cfg(feature = "unproven")]
use std::collections::HashMap;

use xmltree::Element;

use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
#[cfg(feature = "unproven")]

use crate::new_element;
use crate::svd::endian::Endian;
use crate::types::Parse;
Expand Down Expand Up @@ -137,7 +135,6 @@ impl Parse for Cpu {
}
}

#[cfg(feature = "unproven")]
impl Encode for Cpu {
type Error = anyhow::Error;

Expand Down Expand Up @@ -172,7 +169,6 @@ impl Cpu {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::run_test;
Expand Down
5 changes: 1 addition & 4 deletions src/svd/device.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]
use std::collections::HashMap;
use xmltree::Element;

Expand All @@ -8,10 +7,9 @@ use rayon::prelude::*;
use crate::parse;
use crate::types::Parse;

#[cfg(feature = "unproven")]
use crate::encode::{Encode, EncodeChildren};
use crate::error::*;
#[cfg(feature = "unproven")]

use crate::new_element;
use crate::svd::{cpu::Cpu, peripheral::Peripheral, registerproperties::RegisterProperties};

Expand Down Expand Up @@ -180,7 +178,6 @@ impl Device {
}
}

#[cfg(feature = "unproven")]
impl Encode for Device {
type Error = anyhow::Error;

Expand Down
4 changes: 0 additions & 4 deletions src/svd/dimelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmltree::Element;
use crate::types::{parse_optional, DimIndex, Parse};

use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]
use crate::encode::Encode;
#[cfg(feature = "unproven")]
use crate::new_element;

use crate::error::*;
Expand Down Expand Up @@ -77,7 +75,6 @@ impl Parse for DimElement {
}
}

#[cfg(feature = "unproven")]
impl Encode for DimElement {
type Error = anyhow::Error;

Expand All @@ -100,7 +97,6 @@ impl Encode for DimElement {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::run_test;
Expand Down
4 changes: 0 additions & 4 deletions src/svd/endian.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#[cfg(feature = "unproven")]
use std::collections::HashMap;

use xmltree::Element;

use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::types::Parse;

Expand Down Expand Up @@ -36,7 +34,6 @@ impl Parse for Endian {
}
}

#[cfg(feature = "unproven")]
impl Encode for Endian {
type Error = anyhow::Error;

Expand All @@ -61,7 +58,6 @@ impl Encode for Endian {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::run_test;
Expand Down
5 changes: 0 additions & 5 deletions src/svd/enumeratedvalue.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#[cfg(feature = "unproven")]
use std::collections::HashMap;

use crate::elementext::ElementExt;
use crate::parse;
use xmltree::Element;

#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
#[cfg(feature = "unproven")]
use crate::new_element;
use crate::types::Parse;

Expand Down Expand Up @@ -130,7 +127,6 @@ impl Parse for EnumeratedValue {
}
}

#[cfg(feature = "unproven")]
impl Encode for EnumeratedValue {
type Error = anyhow::Error;

Expand Down Expand Up @@ -165,7 +161,6 @@ impl Encode for EnumeratedValue {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::run_test;
Expand Down
6 changes: 1 addition & 5 deletions src/svd/enumeratedvalues.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#[cfg(feature = "unproven")]
use std::collections::HashMap;

use crate::elementext::ElementExt;
use xmltree::Element;

#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
#[cfg(feature = "unproven")]

use crate::new_element;
use crate::parse;
use crate::svd::{enumeratedvalue::EnumeratedValue, usage::Usage};
Expand Down Expand Up @@ -143,7 +141,6 @@ impl Parse for EnumeratedValues {
}
}

#[cfg(feature = "unproven")]
impl Encode for EnumeratedValues {
type Error = anyhow::Error;

Expand Down Expand Up @@ -180,7 +177,6 @@ impl Encode for EnumeratedValues {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::svd::enumeratedvalue::EnumeratedValueBuilder;
Expand Down
6 changes: 2 additions & 4 deletions src/svd/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use xmltree::Element;

use crate::types::Parse;

#[cfg(feature = "unproven")]
use crate::elementext::ElementExt;
#[cfg(feature = "unproven")]

use crate::encode::Encode;
use crate::error::*;
use crate::svd::{dimelement::DimElement, fieldinfo::FieldInfo};
Expand Down Expand Up @@ -51,7 +50,7 @@ impl Parse for Field {
}
}

#[cfg(feature = "unproven")]

impl Encode for Field {
type Error = anyhow::Error;

Expand All @@ -69,7 +68,6 @@ impl Encode for Field {
}

#[cfg(test)]
#[cfg(feature = "unproven")]
mod tests {
use super::*;
use crate::bitrange::{BitRange, BitRangeType};
Expand Down
Loading