Skip to content

Commit 3e10f53

Browse files
author
Olle Ronstad
committed
added trampoline to hardware tasks
.
1 parent 8fb038b commit 3e10f53

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

rtic-macros/src/codegen/hardware_tasks.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::codegen::util;
12
use crate::syntax::{ast::App, Context};
23
use crate::{
34
analyze::Analysis,
@@ -23,9 +24,12 @@ pub fn codegen(app: &App, analysis: &Analysis) -> TokenStream2 {
2324
let entry_stmts = interrupt_entry(app, analysis);
2425
let exit_stmts = interrupt_exit(app, analysis);
2526
let config = handler_config(app, analysis, symbol.clone());
26-
27+
2728
if let Some(trampoline) = &task.args.trampoline {
2829
let trampoline_symbol = trampoline.clone();
30+
let trampoline_config = handler_config(app, analysis, trampoline_symbol.clone());
31+
let rt_err = util::rt_err_ident();
32+
2933
mod_app.push(quote!(
3034

3135
#[allow(non_snake_case)]
@@ -34,14 +38,17 @@ pub fn codegen(app: &App, analysis: &Analysis) -> TokenStream2 {
3438
#(#cfgs)*
3539
#(#config)*
3640
unsafe fn #symbol() {
37-
rtic::export::pend(rtic::export::Interrupt::#trampoline_symbol);
41+
info!("Pend trampoline");
42+
use #rt_err::Interrupt;
43+
rtic::pend(Interrupt::#trampoline_symbol);
44+
info!("Exit trampoline handler");
3845
}
3946

4047
#[allow(non_snake_case)]
4148
#[no_mangle]
4249
#(#attrs)*
4350
#(#cfgs)*
44-
#(#config)*
51+
#(#trampoline_config)*
4552
unsafe fn #trampoline_symbol() {
4653
#(#entry_stmts)*
4754

0 commit comments

Comments
 (0)