@@ -28,19 +28,6 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
28
28
}
29
29
} ;
30
30
31
- let settings = match config. settings . as_ref ( ) {
32
- #[ cfg( feature = "yaml" ) ]
33
- Some ( settings) => {
34
- let file = std:: fs:: read_to_string ( settings) . context ( "could not read settings file" ) ?;
35
- Some ( serde_yaml:: from_str ( & file) . context ( "could not parse settings file" ) ?)
36
- }
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
- }
41
- None => None ,
42
- } ;
43
-
44
31
// make_mod option explicitly disables inner attributes.
45
32
if config. target == Target :: Msp430 && !config. make_mod {
46
33
out. extend ( quote ! {
@@ -203,7 +190,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
203
190
204
191
match config. target {
205
192
Target :: RISCV => {
206
- if settings. is_none ( ) {
193
+ if config . settings . riscv_config . is_none ( ) {
207
194
warn ! ( "No settings file provided for RISC-V target. Using legacy interrupts rendering" ) ;
208
195
warn ! ( "Please, consider migrating your PAC to riscv 0.12.0 or later" ) ;
209
196
out. extend ( interrupt:: render (
@@ -214,12 +201,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
214
201
) ?) ;
215
202
} else {
216
203
debug ! ( "Rendering RISC-V specific code" ) ;
217
- out. extend ( riscv:: render (
218
- & d. peripherals ,
219
- device_x,
220
- settings. as_ref ( ) . unwrap ( ) ,
221
- config,
222
- ) ?) ;
204
+ out. extend ( riscv:: render ( & d. peripherals , device_x, config) ?) ;
223
205
}
224
206
}
225
207
_ => {
@@ -241,10 +223,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
241
223
// Core peripherals are handled above
242
224
continue ;
243
225
}
244
- if config. target == Target :: RISCV
245
- && settings. is_some ( )
246
- && riscv:: is_riscv_peripheral ( p, settings. as_ref ( ) . unwrap ( ) )
247
- {
226
+ if config. target == Target :: RISCV && riscv:: is_riscv_peripheral ( p, & config. settings ) {
248
227
// RISC-V specific peripherals are handled above
249
228
continue ;
250
229
}
0 commit comments