From f76b833029ad4bcd1268b38e53d947450952fee6 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Wed, 4 Dec 2019 17:28:59 +0900 Subject: [PATCH 1/2] tests: lib: mem_alloc: Fix incorrect newlib variant usage NEWLIB_LIBC_NANO defaults to y when building with a toolchain that supports nano.specs and this was causing the libraries.libc.newlib test to link with the newlib nano variant (libc_nano.a) when it should be linking with the normal newlib (libc.a). By setting CONFIG_NEWLIB_LIBC_NANO=n in prj_newlib.conf, we make sure that the libraries.libc.newlib test links with the normal newlib. For more details, refer to the issue #21167. Signed-off-by: Stephanos Ioannidis --- tests/lib/mem_alloc/prj_newlib.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/mem_alloc/prj_newlib.conf b/tests/lib/mem_alloc/prj_newlib.conf index dabdfd5997038..36fb791af634b 100644 --- a/tests/lib/mem_alloc/prj_newlib.conf +++ b/tests/lib/mem_alloc/prj_newlib.conf @@ -1,4 +1,5 @@ CONFIG_ZTEST=y CONFIG_NEWLIB_LIBC=y +CONFIG_NEWLIB_LIBC_NANO=n CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE=512 CONFIG_TEST_USERSPACE=y From f1939c9c44b8f3cb5cc914faad62819a62818c7b Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Thu, 13 Feb 2020 13:42:33 +0900 Subject: [PATCH 2/2] tests: lib: mem_alloc: Increase malloc heap size for newlib test The newlib full malloc implementation (i.e. non-nano) requests a relatively large 4096-byte memory chunk through `_sbrk`, which exceeds the configured 512-byte heap size. This commit changes `CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE` from 512 to 8192 in order to increase the size of the heap memory used by the newlib malloc function. For more details, refer to the issue #21167. Signed-off-by: Stephanos Ioannidis --- tests/lib/mem_alloc/prj_newlib.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/mem_alloc/prj_newlib.conf b/tests/lib/mem_alloc/prj_newlib.conf index 36fb791af634b..edf093027c395 100644 --- a/tests/lib/mem_alloc/prj_newlib.conf +++ b/tests/lib/mem_alloc/prj_newlib.conf @@ -1,5 +1,5 @@ CONFIG_ZTEST=y CONFIG_NEWLIB_LIBC=y CONFIG_NEWLIB_LIBC_NANO=n -CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE=512 +CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE=8192 CONFIG_TEST_USERSPACE=y