@@ -28,19 +28,6 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
2828 }
2929 } ;
3030
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-
4431 // make_mod option explicitly disables inner attributes.
4532 if config. target == Target :: Msp430 && !config. make_mod {
4633 out. extend ( quote ! {
@@ -203,7 +190,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
203190
204191 match config. target {
205192 Target :: RISCV => {
206- if settings. is_none ( ) {
193+ if config . settings . riscv_config . is_none ( ) {
207194 warn ! ( "No settings file provided for RISC-V target. Using legacy interrupts rendering" ) ;
208195 warn ! ( "Please, consider migrating your PAC to riscv 0.12.0 or later" ) ;
209196 out. extend ( interrupt:: render (
@@ -214,12 +201,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
214201 ) ?) ;
215202 } else {
216203 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) ?) ;
223205 }
224206 }
225207 _ => {
@@ -241,10 +223,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
241223 // Core peripherals are handled above
242224 continue ;
243225 }
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 ) {
248227 // RISC-V specific peripherals are handled above
249228 continue ;
250229 }
0 commit comments