apache / apache/nuttx

Heap base shall be configurable.

Open
#2,002 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

On STM32, heap base is defined as:
`#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)`

This makes the assumption that the heap will always be after BSS & Idle Stack, which is not always possible.
On systems with multiple RAM regions, that are not contiguous, this is not going to work.

For example, I am using an STM32F427, that has:
- 64k @ 0x10000000
- 192k @ 0x20000000

This forces me to place everything in the 192k SRAM region (and thus lose the CCM), or place everything in CCM (64k), and not be able to take advantage of the full 192k RAM of the system.

Even worse, if I place BSS in 64k and select `CONFIG_STM32_CCMEXCLUDE`, **the heap will still be located within CCM**, and will extend till the end of the 192k RAM (of course with a "hole" in between).

I believe that we need a different way of defining the Heap.
Examples/ideas:
- FreeRTOS heap_5 [uses a table](https://www.freertos.org/FreeRTOS_Support_Forum_Archive/July_2017/freertos_Using_heap_5.c_d1dfe891j.html).
- Linker script regions or symbols may be defined for the heap.
- We may set HEAP_BASE (and size) in Kconfig.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.