reclaim stack space used in init

This commit is contained in:
Conor Patrick 2021-04-18 14:35:11 -07:00
parent b8b13573ae
commit bc10fe266d

View file

@ -66,9 +66,17 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
#(#pre_init_stmts)*
#[inline(never)]
fn __rtic_init_resources<F>(f: F) where F: FnOnce() {
f();
}
// Wrap late_init_stmts in a function to ensure that stack space is reclaimed.
__rtic_init_resources(||{
#call_init
#(#post_init_stmts)*
});
#call_idle
}