From 4060c3def88f82d4e4f48de7137ce365167ef265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas=20Rodr=C3=ADguez?= Date: Wed, 20 Mar 2024 21:06:47 +0100 Subject: RISC-V support over CLINT (#815) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rebase to master * using interrupt_mod * bug fixes * fix other backends * Add changelog * forgot about rtic-macros * backend-specific configuration * core peripherals optional over macro argument * pre_init_preprocessing binding * CI for RISC-V (WIP) * separation of concerns * add targets for RISC-V examples * remove qemu feature * prepare examples folder * move examples all together * move ci out of examples * minor changes * add cortex-m * new xtask: proof of concept * fix build.yml * feature typo * clean rtic examples * reproduce weird issue * remove unsafe code in user app * update dependencies * allow builds on riscv32imc * let's fix QEMU * Update .github/workflows/build.yml Co-authored-by: Henrik Tjäder * New build.rs * removing test features * adapt ui test to new version of clippy * add more examples to RISC-V backend * proper configuration of heapless for riscv32imc * opt-out examples for riscv32imc * point to new version of riscv-slic * adapt new macro bindings * adapt examples and CI to stable * fix cortex-m CI * Review --------- Co-authored-by: Henrik Tjäder --- rtic-macros/src/codegen/bindings/template.rs | 60 ++++++++++++++++++---------- 1 file changed, 40 insertions(+), 20 deletions(-) (limited to 'rtic-macros/src/codegen/bindings/template.rs') diff --git a/rtic-macros/src/codegen/bindings/template.rs b/rtic-macros/src/codegen/bindings/template.rs index b5488b7..ecb46d5 100644 --- a/rtic-macros/src/codegen/bindings/template.rs +++ b/rtic-macros/src/codegen/bindings/template.rs @@ -6,40 +6,55 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; use syn::{parse, Attribute, Ident}; +pub fn interrupt_ident() -> Ident { + let span = Span::call_site(); + Ident::new("interrupt", span) +} + +pub fn interrupt_mod(app: &App) -> TokenStream2 { + let device = &app.args.device; + let interrupt = interrupt_ident(); + quote!(#device::#interrupt) +} + pub fn impl_mutex( - _app: &App, - _analysis: &CodegenAnalysis, - _cfgs: &[Attribute], - _resources_prefix: bool, - _name: &Ident, - _ty: &TokenStream2, - _ceiling: u8, - _ptr: &TokenStream2, + app: &App, + analysis: &CodegenAnalysis, + cfgs: &[Attribute], + resources_prefix: bool, + name: &Ident, + ty: &TokenStream2, + ceiling: u8, + ptr: &TokenStream2, ) -> TokenStream2 { quote!() } -pub fn extra_assertions(_app: &App, _analysis: &SyntaxAnalysis) -> Vec { +pub fn extra_assertions(app: &App, analysis: &SyntaxAnalysis) -> Vec { vec![] } -pub fn pre_init_checks(_app: &App, _analysis: &SyntaxAnalysis) -> Vec { +pub fn pre_init_preprocessing(app: &mut App, analysis: &SyntaxAnalysis) -> parse::Result<()> { + Ok(()) +} + +pub fn pre_init_checks(app: &App, analysis: &SyntaxAnalysis) -> Vec { vec![] } -pub fn pre_init_enable_interrupts(_app: &App, _analysis: &CodegenAnalysis) -> Vec { +pub fn pre_init_enable_interrupts(app: &App, analysis: &CodegenAnalysis) -> Vec { vec![] } -pub fn architecture_specific_analysis(_app: &App, _analysis: &SyntaxAnalysis) -> parse::Result<()> { +pub fn architecture_specific_analysis(app: &App, analysis: &SyntaxAnalysis) -> parse::Result<()> { Ok(()) } -pub fn interrupt_entry(_app: &App, _analysis: &CodegenAnalysis) -> Vec { +pub fn interrupt_entry(app: &App, analysis: &CodegenAnalysis) -> Vec { vec![] } -pub fn interrupt_exit(_app: &App, _analysis: &CodegenAnalysis) -> Vec { +pub fn interrupt_exit(app: &App, analysis: &CodegenAnalysis) -> Vec { vec![] } @@ -51,20 +66,25 @@ pub fn check_stack_overflow_before_init( } pub fn async_entry( - _app: &App, - _analysis: &CodegenAnalysis, - _dispatcher_name: Ident, + app: &App, + analysis: &CodegenAnalysis, + dispatcher_name: Ident, ) -> Vec { vec![] } -pub fn async_prio_limit(app: &App, _analysis: &CodegenAnalysis) -> Vec { +pub fn async_prio_limit(app: &App, analysis: &CodegenAnalysis) -> Vec { vec![] } + pub fn handler_config( - _app: &App, - _analysis: &CodegenAnalysis, + app: &App, + analysis: &CodegenAnalysis, dispatcher_name: Ident, ) -> Vec { vec![] } + +pub fn extra_modules(app: &App, analysis: &SyntaxAnalysis) -> Vec { + vec![] +} -- cgit v1.2.3