This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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
  • Dear Tamir,

    There is no problem with that. I just want to avoid the "compile time alloc" thing. Of-course if I can not find a solution i'll use something like that

    uint8_t kstack_privil[KERNEL_PRIVILEGED_STACK_SIZE];
    uint8_t kstack_unprivil[KERNEL_UNPRIVILEGED_STACK_SIZE];
    

    And I'll make the allocator to give stack slices from these tables.

    Christos.

Reply
  • Dear Tamir,

    There is no problem with that. I just want to avoid the "compile time alloc" thing. Of-course if I can not find a solution i'll use something like that

    uint8_t kstack_privil[KERNEL_PRIVILEGED_STACK_SIZE];
    uint8_t kstack_unprivil[KERNEL_UNPRIVILEGED_STACK_SIZE];
    

    And I'll make the allocator to give stack slices from these tables.

    Christos.

Children