File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
1
use anyhow:: { Ok , Result } ;
2
2
use clap:: Parser ;
3
3
use std:: { fs:: File , io:: Write , path:: PathBuf , str:: FromStr } ;
4
+ use svd_rs:: ValidateLevel ;
4
5
5
6
use svdtools:: {
6
7
convert:: convert_cli,
@@ -211,6 +212,7 @@ impl Command {
211
212
expand : * expand,
212
213
expand_properties : * expand_properties,
213
214
ignore_enums : * ignore_enums,
215
+ validate_level : ValidateLevel :: Disabled ,
214
216
} ,
215
217
format_config. as_ref ( ) . map ( |p| p. as_path ( ) ) ,
216
218
) ?,
@@ -242,11 +244,9 @@ impl Command {
242
244
input_format,
243
245
out_path,
244
246
} => {
245
- let device = convert_cli:: open_svd (
246
- in_path,
247
- * input_format,
248
- convert_cli:: ParserConfig :: default ( ) ,
249
- ) ?;
247
+ let mut cfg = convert_cli:: ParserConfig :: default ( ) ;
248
+ cfg. validate_level = ValidateLevel :: Disabled ;
249
+ let device = convert_cli:: open_svd ( in_path, * input_format, cfg) ?;
250
250
let yml = enum_extract ( & device) ;
251
251
let mut out_str = String :: new ( ) ;
252
252
let mut emitter = yaml_rust:: YamlEmitter :: new ( & mut out_str) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use anyhow::{anyhow, Result};
2
2
use std:: io:: { Read , Write } ;
3
3
use std:: str:: FromStr ;
4
4
use std:: { fs:: File , path:: Path } ;
5
- use svd_rs:: Device ;
5
+ use svd_rs:: { Device , ValidateLevel } ;
6
6
7
7
use crate :: get_encoder_config;
8
8
pub use crate :: ConfigFormat ;
@@ -52,6 +52,7 @@ pub struct ParserConfig {
52
52
pub expand : bool ,
53
53
pub expand_properties : bool ,
54
54
pub ignore_enums : bool ,
55
+ pub validate_level : ValidateLevel ,
55
56
}
56
57
57
58
pub fn open_svd (
@@ -73,7 +74,9 @@ pub fn open_svd(
73
74
let mut device = match input_format {
74
75
InputFormat :: Xml => svd_parser:: parse_with_config (
75
76
& input,
76
- & svd_parser:: Config :: default ( ) . ignore_enums ( parser_config. ignore_enums ) ,
77
+ & svd_parser:: Config :: default ( )
78
+ . ignore_enums ( parser_config. ignore_enums )
79
+ . validate_level ( parser_config. validate_level ) ,
77
80
) ?,
78
81
InputFormat :: Yaml => serde_yaml:: from_str ( & input) ?,
79
82
InputFormat :: Json => serde_json:: from_str ( & input) ?,
You can’t perform that action at this time.
0 commit comments