Skip to content

Commit

Permalink
zephyr: lib: alloc.c: Add heap for ARM64 platforms
Browse files Browse the repository at this point in the history
This commit places the heap inside the .bss section for
all ARM64 platforms.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
  • Loading branch information
LaurentiuM1234 authored and dbaluta committed Apr 20, 2023
1 parent 9483c19 commit 6aa71dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ __section(".heap_mem") static uint8_t __aligned(PLATFORM_DCACHE_ALIGN) heapmem[H
#define HEAPMEM_SIZE (256 * 1024)
char __aligned(8) heapmem[HEAPMEM_SIZE];

#elif defined(CONFIG_ARM64)
/* for ARM64 the heap is placed inside the .bss section.
*
* This is because we want to avoid introducing new sections in
* the arm64 linker script. Also, is there really a need to place
* it inside a special section?
*
* i.MX93 is the only ARM64-based platform so defining the heap this way
* for all ARM64-based platforms should be safe.
*/
static uint8_t __aligned(PLATFORM_DCACHE_ALIGN) heapmem[HEAPMEM_SIZE];

#else

extern char _end[], _heap_sentry[];
Expand Down

0 comments on commit 6aa71dd

Please sign in to comment.