Skip to content

Commit a0e833c

Browse files
committed
Fix building without yaml feature
1 parent 8b809ac commit a0e833c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::Path;
99

1010
use crate::config::{Config, Target};
1111
use crate::util::{self, ident};
12-
use anyhow::{Context, Result};
12+
use anyhow::{anyhow, Context, Result};
1313

1414
use crate::generate::{interrupt, peripheral, riscv};
1515

@@ -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!("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)