Get Stack init info at runtime

Hi,

Is there any way to get information about stack and heap at runtime in a C function? I'm looking for a var/table/way to get Stack_Base, Heap_base, Stack_limit and heap_limit at runtime.

That's because I'm trying to make a very very small multitasking kernel for Cortex-M3 and I need somehow to know the Stack memory avail for my alloc routines.

Regards,

Christos Houtouridis,
Electrical Engineer

Parents
  • Well if you are writing a kernel, this information is already available to you - not? _YOU_ are the one assigning the stack pointers of the chip upon context switch, and you have control over where stack space for tasks starts and ends - not? The same goes for a heap manager yo may write - whatever your RAM allocation method. There is a RTL function to get heap information, but it is nasty (I don't remember it's name).

Reply
  • Well if you are writing a kernel, this information is already available to you - not? _YOU_ are the one assigning the stack pointers of the chip upon context switch, and you have control over where stack space for tasks starts and ends - not? The same goes for a heap manager yo may write - whatever your RAM allocation method. There is a RTL function to get heap information, but it is nasty (I don't remember it's name).

Children
More questions in this forum