I’m programming in C for RAM limited embedded microcontroller with RTOS.
I regularly break my code to short functions, but every function calling require to more stack memory. Every task needs his stack, and this is one of the significant memory consumers in the project.
Is there an alternative to keep the code well organized and readable, still preserve the memory?
Try to make the call stack flatter, so instead of
a()callingb()which callsc()which callsd(), havea()callb(),c(), andd()itself.If a function is only referenced once, mark it
inline(assuming your compiler supports this).