Replies: 1 comment
-
|
I love the first approach. This feature would also benefit other external, PSRAM, supporting SOCs such as the SiliconLabs siw91x offerings. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE is defined with a positive value, the common libc implementation defines an array to hold the heap for the malloc/calloc/realloc functions of the libc.
This array is placed by default in the noinit section, through the definition of the POOL_SECTION macro in line 85 of the file zephyr/lib/libc/common/source/stdlib/malloc.c:
static POOL_SECTION unsigned char __aligned(HEAP_ALIGN) malloc_arena[HEAP_SIZE];
I would like to enable the user to choose an alternative location for the malloc_arena array, giving the possiblity to choose, for instance, a section mapped on an external RAM in the target board.
A possible implementation is given in this patch:
An alternative would be to change the definition of the HEAP_BASE and the HEAP_SIZE to build the default heap on a different region. However this requires more careful computations that involve the size of the region and its begining address. It seems more reasonable to me to make it target specific in that case. For instance, esp32 platforms, the following patch maps the heap on the external RAM if the user chooses to do it:
Both options were tested on a esp_wrover_kit to map the heap on the external RAM, and worked well. Notice that these are only two possibilities, the former is platform independent but the latter is plaform specific. Any alternatives/suggestions are wellcomed. I just want to request your comments on this topic, and if the community finds something simmilar to the above solutions reasonable, I would work on a pull request for the agreed-upon solution. Please leave your comments.
Thank you all.
Beta Was this translation helpful? Give feedback.
All reactions