kernel: each kheap buffer has its own section attribute

This attaches a unique section attribute for each kheap
buffer defined with K_HEAP_DEFINE(). This allows them
to be placed as needed via linker scripts. This is useful
for demand paging as developers can choose which can be
pinned in memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-07-19 14:09:25 -07:00 committed by Christopher Friedt
commit d92d1f162a

View file

@ -5037,7 +5037,8 @@ void k_heap_free(struct k_heap *h, void *mem);
* @param bytes Size of memory region, in bytes
*/
#define K_HEAP_DEFINE(name, bytes) \
char __aligned(8) /* CHUNK_UNIT */ \
char __noinit_named(kheap_buf_##name) \
__aligned(8) /* CHUNK_UNIT */ \
kheap_##name[MAX(bytes, Z_HEAP_MIN_SIZE)]; \
STRUCT_SECTION_ITERABLE(k_heap, name) = { \
.heap = { \