Recover stack used by main() with freeRTOS

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

The freeRTOS doucmentation states that if you are need more ram you could recover the satck used by main (if the scheduler is not suposed to return of course). So my question is: how do I recover the stack used ny main? I have no clue...

Thanks. Best regards,

Daniel Campora http://www.wipy.io

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simplest is not to use much stack in main. Call an init subroutine that allocates and uses the needed temporary stack variables, and when that returns the stack space is freed. E.g.

void init(void) {
int foo[10],bar[100];
  foo_mung(foo);
  bar_mung(bar);
  return;
}
int main(void){
  init();
  mung_all();
  return 0;
}