Skip to content

Commit 74f0b64

Browse files
stephanosiocfriedt
authored andcommitted
lib: libc: newlib: Initialise libc heap during POST_KERNEL phase
This commit changes the invocation of the newlib malloc heap initialisation function such that it is executed during the POST_KERNEL phase instead of the APPLICATION phase. This is necessary in order to ensure that the application initialisation functions (i.e. the functions called during the APPLICATIION phase) can make use of the libc heap. Signed-off-by: Stephanos Ioannidis <[email protected]> (cherry picked from commit 43e1c28)
1 parent 6c16b34 commit 74f0b64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/libc/newlib/libc-hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static int malloc_prepare(const struct device *unused)
133133
return 0;
134134
}
135135

136-
SYS_INIT(malloc_prepare, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
136+
SYS_INIT(malloc_prepare, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
137137

138138
/* Current offset from HEAP_BASE of unused memory */
139139
LIBC_BSS static size_t heap_sz;

0 commit comments

Comments
 (0)