diff --git a/doc/develop/languages/c/common_libc.rst b/doc/develop/languages/c/common_libc.rst new file mode 100644 index 0000000000000..643265a63e188 --- /dev/null +++ b/doc/develop/languages/c/common_libc.rst @@ -0,0 +1,47 @@ +.. _c_library_common: + +Common C library code +##################### + +Zephyr provides some C library functions that are designed to be used in +conjunction with multiple C libraries. These either provide functions not +available in multiple C libraries or are designed to replace functionality +in the C library with code better suited for use in the Zephyr environment + +Time function +************* + +This provides an implementation of the standard C function, :c:func:`time`, +relying on the Zephyr function, :c:func:`clock_gettime`. This function can +be enabled by selecting :kconfig:option:`COMMON_LIBC_TIME`. + +Dynamic Memory Management +************************* + +The common dynamic memory management implementation can be enabled by +selecting the :kconfig:option:`CONFIG_COMMON_LIBC_MALLOC` in the +application configuration file. + +The common C library internally uses the :ref:`kernel memory heap API +` to manage the memory heap used by the standard dynamic memory +management interface functions such as :c:func:`malloc` and :c:func:`free`. + +The internal memory heap is normally located in the ``.bss`` section. When +userspace is enabled, however, it is placed in a dedicated memory partition +called ``z_malloc_partition``, which can be accessed from the user mode +threads. The size of the internal memory heap is specified by the +:kconfig:option:`CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE`. + +The default heap size for applications using the common C library is zero +(no heap). For other C library users, if there is an MMU present, then the +default heap is 16kB. Otherwise, the heap uses all available memory. + +There are also separate controls to select :c:func:`calloc` +(:kconfig:option:`COMMON_LIBC_CALLOC`) and :c:func:`reallocarray` +(:kconfig:option:`COMMON_LIBC_REALLOCARRAY`). Both of these are enabled by +default as that doesn't impact memory usage in applications not using them. + +The standard dynamic memory management interface functions implemented by +the common C library are thread safe and may be simultaneously called by +multiple threads. These functions are implemented in +:file:`lib/libc/common/source/stdlib/malloc.c`. diff --git a/doc/develop/languages/c/index.rst b/doc/develop/languages/c/index.rst index cc817a737ab9e..8cd19737ba833 100644 --- a/doc/develop/languages/c/index.rst +++ b/doc/develop/languages/c/index.rst @@ -63,6 +63,7 @@ application. .. toctree:: :maxdepth: 2 + common_libc.rst minimal_libc.rst newlib.rst picolibc.rst diff --git a/doc/develop/languages/c/minimal_libc.rst b/doc/develop/languages/c/minimal_libc.rst index c3da93f0cfff3..173b796d087c9 100644 --- a/doc/develop/languages/c/minimal_libc.rst +++ b/doc/develop/languages/c/minimal_libc.rst @@ -29,24 +29,9 @@ service documentation. Dynamic Memory Management ************************* -Dynamic memory management in the minimal libc can be enabled by selecting the -:kconfig:option:`CONFIG_MINIMAL_LIBC_MALLOC` in the application configuration -file. - -The minimal libc internally uses the :ref:`kernel memory heap API ` to -manage the memory heap used by the standard dynamic memory management interface -functions such as :c:func:`malloc` and :c:func:`free`. - -The internal memory heap is normally located in the ``.bss`` section. When -userspace is enabled, however, it is placed in a dedicated memory partition -called ``z_malloc_partition``, which can be accessed from the user mode -threads. The size of the internal memory heap is specified by the -:kconfig:option:`CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE`. - -The standard dynamic memory management interface functions implemented by the -minimal libc are thread safe and may be simultaneously called by multiple -threads. These functions are implemented in -:file:`lib/libc/minimal/source/stdlib/malloc.c`. +The minimal libc uses the malloc api family implementation provided by the +:ref:`common C library `, which itself is built upon the +:ref:`kernel memory heap API `. Error numbers ************* diff --git a/include/zephyr/sys/libc-hooks.h b/include/zephyr/sys/libc-hooks.h index 8b6050152a28c..1d82462ba69fb 100644 --- a/include/zephyr/sys/libc-hooks.h +++ b/include/zephyr/sys/libc-hooks.h @@ -39,8 +39,31 @@ __syscall size_t zephyr_fwrite(const void *ZRESTRICT ptr, size_t size, size_t nitems, FILE *ZRESTRICT stream); #endif /* CONFIG_NEWLIB_LIBC */ +/* Handle deprecated malloc arena size configuration values */ +#ifdef CONFIG_COMMON_LIBC_MALLOC +# if CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE == 0 +# undef CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE +# ifdef CONFIG_MINIMAL_LIBC +# define CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE +# else +# define CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE 0 +# endif +# endif +#endif + #ifdef CONFIG_USERSPACE -#if defined(CONFIG_NEWLIB_LIBC) +#ifdef CONFIG_COMMON_LIBC_MALLOC + +/* When using the common malloc implementation with CONFIG_USERSPACE, the + * heap will be in a separate partition when there's an MPU or MMU + * available. + */ +#if CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0 && \ +(defined(CONFIG_MPU) || defined(CONFIG_MMU)) +#define Z_MALLOC_PARTITION_EXISTS 1 +#endif + +#elif defined(CONFIG_NEWLIB_LIBC) /* If we are using newlib, the heap arena is in one of two areas: * - If we have an MPU that requires power of two alignment, the heap bounds * must be specified in Kconfig via CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE. @@ -54,13 +77,6 @@ __syscall size_t zephyr_fwrite(const void *ZRESTRICT ptr, size_t size, #define Z_MALLOC_PARTITION_EXISTS 1 extern struct k_mem_partition z_malloc_partition; #endif -#elif defined(CONFIG_MINIMAL_LIBC) -#if (CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE > 0) -/* Minimal libc by default has no malloc arena, its size must be set in - * Kconfig via CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE - */ -#define Z_MALLOC_PARTITION_EXISTS 1 -#endif /* CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE > 0 */ #elif defined(CONFIG_PICOLIBC) /* diff --git a/lib/libc/common/CMakeLists.txt b/lib/libc/common/CMakeLists.txt index 207cef418f6a5..d3be18563eb2b 100644 --- a/lib/libc/common/CMakeLists.txt +++ b/lib/libc/common/CMakeLists.txt @@ -1,4 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_library() +zephyr_library_property(ALLOW_EMPTY TRUE) zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_TIME source/time/time.c) +zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_MALLOC source/stdlib/malloc.c) diff --git a/lib/libc/common/Kconfig b/lib/libc/common/Kconfig index 6e155957f216c..e661c7f23d13d 100644 --- a/lib/libc/common/Kconfig +++ b/lib/libc/common/Kconfig @@ -5,3 +5,35 @@ config COMMON_LIBC_TIME bool help common implementation of time(). + +config COMMON_LIBC_MALLOC + bool "Common C library malloc implementation" + help + Common implementation of malloc family that uses the kernel heap + API. + +config COMMON_LIBC_MALLOC_ARENA_SIZE + int "Size of the common C library malloc arena" + depends on COMMON_LIBC_MALLOC + default 0 + help + Indicate the size in bytes of the memory arena used for + common C library malloc() implementation. + +config COMMON_LIBC_CALLOC + bool "Common C library calloc" + depends on COMMON_LIBC_MALLOC + default n if MINIMAL_LIBC && !MINIMAL_LIBC_CALLOC + default y + help + Enable the common C library trivial implementation of calloc, + which forwards to malloc and memset. + +config COMMON_LIBC_REALLOCARRAY + bool "Common C library reallocarray" + depends on COMMON_LIBC_MALLOC + default n if MINIMAL_LIBC && !MINIMAL_LIBC_REALLOCARRAY + default y + help + Enable the common C library trivial implementation of + reallocarray, which forwards to realloc. diff --git a/lib/libc/minimal/source/stdlib/malloc.c b/lib/libc/common/source/stdlib/malloc.c similarity index 87% rename from lib/libc/minimal/source/stdlib/malloc.c rename to lib/libc/common/source/stdlib/malloc.c index af9b95e94f49f..6ad8ae109fb0e 100644 --- a/lib/libc/minimal/source/stdlib/malloc.c +++ b/lib/libc/common/source/stdlib/malloc.c @@ -13,15 +13,16 @@ #include #include #include +#include #include #define LOG_LEVEL CONFIG_KERNEL_LOG_LEVEL #include LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); -#ifdef CONFIG_MINIMAL_LIBC_MALLOC +#ifdef CONFIG_COMMON_LIBC_MALLOC -#if (CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE > 0) +#if (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE > 0) #ifdef CONFIG_USERSPACE K_APPMEM_PARTITION_DEFINE(z_malloc_partition); #define POOL_SECTION K_APP_DMEM_SECTION(z_malloc_partition) @@ -29,7 +30,7 @@ K_APPMEM_PARTITION_DEFINE(z_malloc_partition); #define POOL_SECTION .bss #endif /* CONFIG_USERSPACE */ -#define HEAP_BYTES CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE +#define HEAP_BYTES CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE Z_GENERIC_SECTION(POOL_SECTION) static struct sys_heap z_malloc_heap; Z_GENERIC_SECTION(POOL_SECTION) struct sys_mutex z_malloc_heap_mutex; @@ -121,7 +122,7 @@ void *malloc(size_t size) { ARG_UNUSED(size); - LOG_ERR("CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE is 0"); + LOG_ERR("CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE is 0"); errno = ENOMEM; return NULL; @@ -139,9 +140,9 @@ void *realloc(void *ptr, size_t size) } #endif -#endif /* CONFIG_MINIMAL_LIBC_MALLOC */ +#endif /* CONFIG_COMMON_LIBC_MALLOC */ -#ifdef CONFIG_MINIMAL_LIBC_CALLOC +#ifdef CONFIG_COMMON_LIBC_CALLOC void *calloc(size_t nmemb, size_t size) { void *ret; @@ -159,19 +160,15 @@ void *calloc(size_t nmemb, size_t size) return ret; } -#endif /* CONFIG_MINIMAL_LIBC_CALLOC */ +#endif /* CONFIG_COMMON_LIBC_CALLOC */ -#ifdef CONFIG_MINIMAL_LIBC_REALLOCARRAY +#ifdef CONFIG_COMMON_LIBC_REALLOCARRAY void *reallocarray(void *ptr, size_t nmemb, size_t size) { -#if (CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE > 0) if (size_mul_overflow(nmemb, size, &size)) { errno = ENOMEM; return NULL; } return realloc(ptr, size); -#else - return NULL; -#endif } -#endif /* CONFIG_MINIMAL_LIBC_REALLOCARRAY */ +#endif /* CONFIG_COMMON_LIBC_REALLOCARRAY */ diff --git a/lib/libc/minimal/CMakeLists.txt b/lib/libc/minimal/CMakeLists.txt index 65996456fbc9a..e389e04772b19 100644 --- a/lib/libc/minimal/CMakeLists.txt +++ b/lib/libc/minimal/CMakeLists.txt @@ -14,7 +14,6 @@ zephyr_library_sources( source/stdlib/strtoul.c source/stdlib/strtoll.c source/stdlib/strtoull.c - source/stdlib/malloc.c source/stdlib/bsearch.c source/stdlib/exit.c source/stdlib/qsort.c diff --git a/lib/libc/minimal/Kconfig b/lib/libc/minimal/Kconfig index 521f17b98fc1b..2e3d97039f692 100644 --- a/lib/libc/minimal/Kconfig +++ b/lib/libc/minimal/Kconfig @@ -14,31 +14,43 @@ config MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS option may require an additional memory protection region. config MINIMAL_LIBC_MALLOC - bool "Minimal libc malloc implementation" + bool "[DEPRECATED] Minimal libc malloc implementation" default y + imply COMMON_LIBC_MALLOC help + [DEPRECATED] Use COMMON_LIBC_MALLOC + Enable the minimal libc's implementation of malloc, free, and realloc. Disable if you wish to provide your own implementations of these functions. config MINIMAL_LIBC_MALLOC_ARENA_SIZE - int "Size of the minimal libc malloc arena" + int "[DEPRECATED] Size of the minimal libc malloc arena" default 0 - depends on MINIMAL_LIBC_MALLOC + depends on COMMON_LIBC_MALLOC help + [DEPRECATED] Use COMMON_LIBC_MALLOC_ARENA_SIZE + + If set to zero, then the value of COMMON_LIBC_MALLOC_ARENA_SIZE + will be used. + Indicate the size in bytes of the memory arena used for minimal libc's malloc() implementation. config MINIMAL_LIBC_CALLOC - bool "Minimal libc trivial calloc implementation" + bool "[DEPRECATED] Minimal libc trivial calloc implementation" default y help + [DEPRECATED] Use COMMON_LIBC_CALLOC + Enable the minimal libc's trivial implementation of calloc, which forwards to malloc and memset. config MINIMAL_LIBC_REALLOCARRAY - bool "Minimal libc trivial reallocarray implementation" + bool "[DEPRECATED] Minimal libc trivial reallocarray implementation" default y help + [DEPRECATED] Use COMMON_LIBC_REALLOCARRAY + Enable the minimal libc's trivial implementation of reallocarray, which forwards to realloc. diff --git a/samples/basic/hash_map/Kconfig b/samples/basic/hash_map/Kconfig index 53cd271f6d738..a721e93b2e21b 100644 --- a/samples/basic/hash_map/Kconfig +++ b/samples/basic/hash_map/Kconfig @@ -16,7 +16,7 @@ config TEST_LIB_HASH_MAP_MAX_ENTRIES heap memory. For test scenarios using the Minimal C library, the heap size is controlled via - CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE + CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE For native_posix_64, the number of entries can be configured independently of the arena size since the native libc is used. diff --git a/samples/basic/hash_map/prj.conf b/samples/basic/hash_map/prj.conf index adc66649c21e3..f0ddf60c25c83 100644 --- a/samples/basic/hash_map/prj.conf +++ b/samples/basic/hash_map/prj.conf @@ -6,7 +6,7 @@ CONFIG_BOOT_BANNER=n CONFIG_LOG=y CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192 CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=8192 CONFIG_PICOLIBC_HEAP_SIZE=8192 diff --git a/samples/bluetooth/peripheral_hr/prj_minimal.conf b/samples/bluetooth/peripheral_hr/prj_minimal.conf index 207c4c1bac3f7..696114ff01543 100644 --- a/samples/bluetooth/peripheral_hr/prj_minimal.conf +++ b/samples/bluetooth/peripheral_hr/prj_minimal.conf @@ -80,7 +80,7 @@ CONFIG_ISR_STACK_SIZE=1024 # Disable features not needed CONFIG_TIMESLICING=n -CONFIG_MINIMAL_LIBC_MALLOC=n +CONFIG_COMMON_LIBC_MALLOC=n CONFIG_LOG=n CONFIG_ASSERT=n diff --git a/samples/cpp/cpp_synchronization/prj.conf b/samples/cpp/cpp_synchronization/prj.conf index 4c99ccacbe80a..7874b0c006c5b 100644 --- a/samples/cpp/cpp_synchronization/prj.conf +++ b/samples/cpp/cpp_synchronization/prj.conf @@ -1,3 +1,3 @@ CONFIG_CPP=y CONFIG_CPP_MAIN=y -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=128 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=128 diff --git a/samples/net/cloud/tagoio_http_post/prj.conf b/samples/net/cloud/tagoio_http_post/prj.conf index a1aa9fe4ea151..cffd6feb142ac 100644 --- a/samples/net/cloud/tagoio_http_post/prj.conf +++ b/samples/net/cloud/tagoio_http_post/prj.conf @@ -2,9 +2,9 @@ CONFIG_MAIN_STACK_SIZE=4096 # C Library -# Default use minimal libc and with MINIMAL_LIBC_MALLOC_ARENA_SIZE defining +# Default use minimal libc and with COMMON_LIBC_MALLOC_ARENA_SIZE defining # HEAP size (512 bytes) are enough to run DNS. -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=4096 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=4096 # Networking config CONFIG_NETWORKING=y diff --git a/samples/subsys/fs/littlefs/boards/nucleo_h743zi.conf b/samples/subsys/fs/littlefs/boards/nucleo_h743zi.conf index da53c4a48f1ba..b4576ceceda0d 100644 --- a/samples/subsys/fs/littlefs/boards/nucleo_h743zi.conf +++ b/samples/subsys/fs/littlefs/boards/nucleo_h743zi.conf @@ -11,7 +11,7 @@ CONFIG_FLASH_MAP=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_STM32_QSPI=y -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192 # Littlefs configuration to utilize QSPI operation CONFIG_FS_LITTLEFS_CACHE_SIZE=256 diff --git a/samples/subsys/fs/littlefs/boards/nucleo_h743zi_blk.conf b/samples/subsys/fs/littlefs/boards/nucleo_h743zi_blk.conf index f6a5fde17577b..eeabf1150b0eb 100644 --- a/samples/subsys/fs/littlefs/boards/nucleo_h743zi_blk.conf +++ b/samples/subsys/fs/littlefs/boards/nucleo_h743zi_blk.conf @@ -4,6 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192 CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=8192 diff --git a/samples/subsys/usb/mass/boards/stm32l562e_dk_ns.conf b/samples/subsys/usb/mass/boards/stm32l562e_dk_ns.conf index 78aeeb367139e..8e1e88f3bde6f 100644 --- a/samples/subsys/usb/mass/boards/stm32l562e_dk_ns.conf +++ b/samples/subsys/usb/mass/boards/stm32l562e_dk_ns.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192 CONFIG_DISK_ACCESS=y CONFIG_DISK_DRIVERS=y diff --git a/tests/lib/cpp/cxx/prj.conf b/tests/lib/cpp/cxx/prj.conf index 3e4cfd717d8fd..70945ee8a6eb4 100644 --- a/tests/lib/cpp/cxx/prj.conf +++ b/tests/lib/cpp/cxx/prj.conf @@ -2,7 +2,7 @@ CONFIG_CPP=y CONFIG_NET_BUF=y CONFIG_ZTEST=y CONFIG_ZTEST_STACK_SIZE=2048 -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=128 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=128 CONFIG_ZTEST_NEW_API=y CONFIG_CRC=y diff --git a/tests/lib/hash_map/Kconfig b/tests/lib/hash_map/Kconfig index 0d37f3867fc7b..85ef69931518a 100644 --- a/tests/lib/hash_map/Kconfig +++ b/tests/lib/hash_map/Kconfig @@ -16,7 +16,7 @@ config TEST_LIB_HASH_MAP_MAX_ENTRIES heap memory. For test scenarios using the Minimal C library, the heap size is controlled via - CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE + CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE For native_posix_64, the number of entries can be configured independently of the arena size since the native libc is used. diff --git a/tests/lib/hash_map/prj.conf b/tests/lib/hash_map/prj.conf index 736f0813e73f6..3a959ff231958 100644 --- a/tests/lib/hash_map/prj.conf +++ b/tests/lib/hash_map/prj.conf @@ -5,7 +5,7 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192 CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=8192 CONFIG_PICOLIBC_HEAP_SIZE=8192 diff --git a/tests/lib/mem_alloc/prj.conf b/tests/lib/mem_alloc/prj.conf index f64af74f8dc8a..d8d148b11448a 100644 --- a/tests/lib/mem_alloc/prj.conf +++ b/tests/lib/mem_alloc/prj.conf @@ -1,4 +1,4 @@ CONFIG_ZTEST=y -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=2048 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=2048 CONFIG_TEST_USERSPACE=y CONFIG_ZTEST_NEW_API=y diff --git a/tests/lib/mem_alloc/prj_negative_testing.conf b/tests/lib/mem_alloc/prj_negative_testing.conf index 5d4badc9e934c..780ea37adc2c4 100644 --- a/tests/lib/mem_alloc/prj_negative_testing.conf +++ b/tests/lib/mem_alloc/prj_negative_testing.conf @@ -1,4 +1,4 @@ CONFIG_ZTEST=y -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=0 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=0 CONFIG_TEST_USERSPACE=y CONFIG_ZTEST_NEW_API=y diff --git a/tests/lib/mem_alloc/src/main.c b/tests/lib/mem_alloc/src/main.c index 228256d79d04f..99c7bf5f450b7 100644 --- a/tests/lib/mem_alloc/src/main.c +++ b/tests/lib/mem_alloc/src/main.c @@ -56,7 +56,7 @@ union aligntest { }; -#if defined(CONFIG_MINIMAL_LIBC) && (CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE == 0) +#if defined(CONFIG_MINIMAL_LIBC) && (CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE == 0) __no_optimization void _test_no_mem_malloc(void) { int *iptr = NULL; diff --git a/tests/subsys/fs/littlefs/prj.conf b/tests/subsys/fs/littlefs/prj.conf index 3a3d2166bb658..9ccaa0d458950 100644 --- a/tests/subsys/fs/littlefs/prj.conf +++ b/tests/subsys/fs/littlefs/prj.conf @@ -5,7 +5,7 @@ CONFIG_ZTEST_NEW_API=y CONFIG_MAIN_STACK_SIZE=4096 # Performance tests need custom buffer allocation -CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192 # FS abstraction layer is noisy so it's off. Turn it on to see the # littlefs configuration parameters.