Disable heap increases available stack?

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
tiko
Posts: 2
Joined: Tue Jul 01, 2014 4:01 pm

Disable heap increases available stack?

Post by tiko »

Hi there,

I work with an STM32F1xx and ChibiOS-RT 2.6.3.
I am a bit confused about the heap memory management by ChibiOS.
Can I disable the heap to allow a bigger available RAM size for the stack?
And if so, how?

One extension point:
I found the following lines in "ChibiOS-RT/os/ports/GCC/ARMCMx/STM32F1xx/ld/STM32F103xE.ld"

Code: Select all

PROVIDE(end = .);
_end            = .;

__heap_base__   = _end;
__heap_end__    = __ram_end__;

Does it mean, that the heap is only as big as the remaining ram size and so forth, I don't have to care about it?
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: Disable heap increases available stack?

Post by colin »

Actually you kind of have it backwards. You assume that the you specify a size for the heap, and then the thread stacks get the remaining RAM. But in fact the thread stack sizes are defined by the project, and the heap is allocated the remaining RAM.

So the static data (.data, .bss) and thread stacks (main thread stack is special, and other thread stacks are part of their working area which is typically part of .bss but could be on the heap I think too if you want to create threads dynamically).

So no, I don't think you can make more stack available by disabling heap since you already get to allocate as much RAM as you want to the stacks. It will just make the RAM available to the heap smaller.
Post Reply