Skip to content

Commit 4563540

Browse files
authored
Merge pull request #877 from jannic-dev-forks/issue-875
Fix building without yaml feature
2 parents 8b809ac + 224fc9d commit 4563540

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
with:
4343
key: ${{ matrix.TARGET }}
4444

45+
- run: cargo check --target ${{ matrix.TARGET }} --no-default-features
46+
env:
47+
RUSTFLAGS: -D warnings
4548
- run: cargo check --target ${{ matrix.TARGET }}
4649
env:
4750
RUSTFLAGS: -D warnings

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
99

10+
- Fix building without `yaml` feature
1011
- Compatibility with `riscv` 0.12 and `riscv-rt` 0.13
1112
- Add `riscv_config` section in `settings.yaml`
1213
It uses `riscv-pac` traits and standard `riscv-peripheral` peripherals.

src/generate/device.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
2929
};
3030

3131
let settings = match config.settings.as_ref() {
32+
#[cfg(feature = "yaml")]
3233
Some(settings) => {
3334
let file = std::fs::read_to_string(settings).context("could not read settings file")?;
3435
Some(serde_yaml::from_str(&file).context("could not parse settings file")?)
3536
}
37+
#[cfg(not(feature = "yaml"))]
38+
Some(_) => {
39+
return Err(anyhow::anyhow!("Support for yaml config files is not available because svd2rust was compiled without the yaml feature"));
40+
}
3641
None => None,
3742
};
3843

0 commit comments

Comments
 (0)