diff options
Diffstat (limited to 'rtic-macros/src/codegen')
| -rw-r--r-- | rtic-macros/src/codegen/bindings/riscv_slic.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/rtic-macros/src/codegen/bindings/riscv_slic.rs b/rtic-macros/src/codegen/bindings/riscv_slic.rs index c9bf50a..f2dc9ed 100644 --- a/rtic-macros/src/codegen/bindings/riscv_slic.rs +++ b/rtic-macros/src/codegen/bindings/riscv_slic.rs @@ -13,7 +13,7 @@ use syn::{parse, Attribute, Ident}; /// Utility function to get the SLIC interrupt module. pub fn interrupt_ident() -> Ident { let span = Span::call_site(); - Ident::new("Interrupt", span) + Ident::new("SoftwareInterrupt", span) } pub fn interrupt_mod(_app: &App) -> TokenStream2 { @@ -119,7 +119,7 @@ pub fn pre_init_enable_interrupts(app: &App, analysis: &CodegenAnalysis) -> Vec< .map(|task| (&task.args.priority, &task.args.binds)), ) { stmts.push(quote!( - rtic::export::set_priority(slic::Interrupt::#name, #p); + rtic::export::set_priority(slic::SoftwareInterrupt::#name, #p); )); } // Finally, we activate the interrupts @@ -153,11 +153,11 @@ pub fn architecture_specific_analysis(app: &App, _analysis: &SyntaxAnalysis) -> return Err(parse::Error::new(first.unwrap().span(), s)); } - + #[cfg(feature = "riscv-clint")] if app.args.backend.is_none() { return Err(parse::Error::new( Span::call_site(), - "SLIC requires backend-specific configuration", + "CLINT requires backend-specific configuration", )); } @@ -247,9 +247,19 @@ pub fn extra_modules(app: &App, _analysis: &SyntaxAnalysis) -> Vec<TokenStream2> stmts.push(quote!( use rtic::export::riscv_slic; )); - let hart_id = &app.args.backend.as_ref().unwrap().hart_id; + let slic = quote! {rtic::export::riscv_slic}; - stmts.push(quote!(rtic::export::codegen!(pac = #device, swi = [#(#swi_slice,)*], backend = [hart_id = #hart_id]);)); + match () { + #[cfg(feature = "riscv-clint")] + () => { + let hart_id = &app.args.backend.as_ref().unwrap().hart_id; + stmts.push(quote!(rtic::export::codegen!(slic = #slic, pac = #device, swi = [#(#swi_slice,)*], backend = [hart_id = #hart_id]);)); + } + #[cfg(feature = "riscv-mecall")] + () => { + stmts.push(quote!(rtic::export::codegen!(slic = #slic, pac = #device, swi = [#(#swi_slice,)*]);)); + } + } stmts } |
