File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 11use anyhow:: { Ok , Result } ;
22use clap:: Parser ;
33use std:: { fs:: File , io:: Write , path:: PathBuf , str:: FromStr } ;
4+ use svd_rs:: ValidateLevel ;
45
56use svdtools:: {
67 convert:: convert_cli,
@@ -211,6 +212,7 @@ impl Command {
211212 expand : * expand,
212213 expand_properties : * expand_properties,
213214 ignore_enums : * ignore_enums,
215+ validate_level : ValidateLevel :: Disabled ,
214216 } ,
215217 format_config. as_ref ( ) . map ( |p| p. as_path ( ) ) ,
216218 ) ?,
@@ -242,11 +244,9 @@ impl Command {
242244 input_format,
243245 out_path,
244246 } => {
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) ?;
250250 let yml = enum_extract ( & device) ;
251251 let mut out_str = String :: new ( ) ;
252252 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};
22use std:: io:: { Read , Write } ;
33use std:: str:: FromStr ;
44use std:: { fs:: File , path:: Path } ;
5- use svd_rs:: Device ;
5+ use svd_rs:: { Device , ValidateLevel } ;
66
77use crate :: get_encoder_config;
88pub use crate :: ConfigFormat ;
@@ -52,6 +52,7 @@ pub struct ParserConfig {
5252 pub expand : bool ,
5353 pub expand_properties : bool ,
5454 pub ignore_enums : bool ,
55+ pub validate_level : ValidateLevel ,
5556}
5657
5758pub fn open_svd (
@@ -73,7 +74,9 @@ pub fn open_svd(
7374 let mut device = match input_format {
7475 InputFormat :: Xml => svd_parser:: parse_with_config (
7576 & 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 ) ,
7780 ) ?,
7881 InputFormat :: Yaml => serde_yaml:: from_str ( & input) ?,
7982 InputFormat :: Json => serde_json:: from_str ( & input) ?,
You can’t perform that action at this time.
0 commit comments