reclaim stack space used in init
@@ -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
}
