From 6cb588820f8e9b3bc466b8a85f3bc56a1e2e50e1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 17 Nov 2023 18:43:30 -0500 Subject: [PATCH] lib: os: move heap to own folder consolidate all heap related files and implementation into one folder. Signed-off-by: Anas Nashif --- lib/CMakeLists.txt | 1 + lib/Kconfig | 2 ++ lib/heap/CMakeLists.txt | 11 +++++++++++ lib/{os/Kconfig.heap => heap/Kconfig} | 0 lib/{os => heap}/heap-validate.c | 0 lib/{os => heap}/heap.c | 0 lib/{os => heap}/heap.h | 0 lib/{os => heap}/heap_listener.c | 0 lib/{os => heap}/multi_heap.c | 0 lib/{os => heap}/shared_multi_heap.c | 0 lib/os/CMakeLists.txt | 7 ------- lib/os/Kconfig | 9 --------- 12 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 lib/heap/CMakeLists.txt rename lib/{os/Kconfig.heap => heap/Kconfig} (100%) rename lib/{os => heap}/heap-validate.c (100%) rename lib/{os => heap}/heap.c (100%) rename lib/{os => heap}/heap.h (100%) rename lib/{os => heap}/heap_listener.c (100%) rename lib/{os => heap}/multi_heap.c (100%) rename lib/{os => heap}/shared_multi_heap.c (100%) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6fe18f63992..ceba13bc2af 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(posix) endif() add_subdirectory_ifdef(CONFIG_CPP cpp) add_subdirectory(hash) +add_subdirectory(heap) add_subdirectory(os) add_subdirectory_ifdef(CONFIG_SMF smf) add_subdirectory_ifdef(CONFIG_OPENAMP open-amp) diff --git a/lib/Kconfig b/lib/Kconfig index 97ee3f6002d..9b6eb56d275 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -11,6 +11,8 @@ menu "Additional libraries" source "lib/hash/Kconfig" +source "lib/heap/Kconfig" + source "lib/os/Kconfig" source "lib/posix/Kconfig" diff --git a/lib/heap/CMakeLists.txt b/lib/heap/CMakeLists.txt new file mode 100644 index 00000000000..bc5f30b4841 --- /dev/null +++ b/lib/heap/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources( + heap.c + heap-validate.c + multi_heap.c + ) + +zephyr_sources_ifdef(CONFIG_SHARED_MULTI_HEAP shared_multi_heap.c) + +zephyr_sources_ifdef(CONFIG_HEAP_LISTENER heap_listener.c) diff --git a/lib/os/Kconfig.heap b/lib/heap/Kconfig similarity index 100% rename from lib/os/Kconfig.heap rename to lib/heap/Kconfig diff --git a/lib/os/heap-validate.c b/lib/heap/heap-validate.c similarity index 100% rename from lib/os/heap-validate.c rename to lib/heap/heap-validate.c diff --git a/lib/os/heap.c b/lib/heap/heap.c similarity index 100% rename from lib/os/heap.c rename to lib/heap/heap.c diff --git a/lib/os/heap.h b/lib/heap/heap.h similarity index 100% rename from lib/os/heap.h rename to lib/heap/heap.h diff --git a/lib/os/heap_listener.c b/lib/heap/heap_listener.c similarity index 100% rename from lib/os/heap_listener.c rename to lib/heap/heap_listener.c diff --git a/lib/os/multi_heap.c b/lib/heap/multi_heap.c similarity index 100% rename from lib/os/multi_heap.c rename to lib/heap/multi_heap.c diff --git a/lib/os/shared_multi_heap.c b/lib/heap/shared_multi_heap.c similarity index 100% rename from lib/os/shared_multi_heap.c rename to lib/heap/shared_multi_heap.c diff --git a/lib/os/CMakeLists.txt b/lib/os/CMakeLists.txt index 4f082716c48..4f403c2a289 100644 --- a/lib/os/CMakeLists.txt +++ b/lib/os/CMakeLists.txt @@ -15,10 +15,7 @@ zephyr_sources( sem.c thread_entry.c timeutil.c - heap.c - heap-validate.c bitarray.c - multi_heap.c ) zephyr_sources_ifdef(CONFIG_FDTABLE fdtable.c) @@ -50,10 +47,6 @@ zephyr_sources_ifdef(CONFIG_SCHED_DEADLINE p4wq.c) zephyr_sources_ifdef(CONFIG_REBOOT reboot.c) -zephyr_sources_ifdef(CONFIG_SHARED_MULTI_HEAP shared_multi_heap.c) - -zephyr_sources_ifdef(CONFIG_HEAP_LISTENER heap_listener.c) - zephyr_sources_ifdef(CONFIG_UTF8 utf8.c) zephyr_sources_ifdef(CONFIG_SYS_MEM_BLOCKS mem_blocks.c) diff --git a/lib/os/Kconfig b/lib/os/Kconfig index e6b25ade5a5..8b41f92f5b2 100644 --- a/lib/os/Kconfig +++ b/lib/os/Kconfig @@ -119,14 +119,6 @@ config SPSC_PBUF_UTILIZATION endif # SPSC_PBUF -config SHARED_MULTI_HEAP - bool "Shared multi-heap manager" - help - Enable support for a shared multi-heap manager that uses the - multi-heap allocator to manage a set of reserved memory regions with - different capabilities / attributes (cacheable, non-cacheable, - etc...) defined in the DT. - config WINSTREAM bool "Lockless shared memory window byte stream" help @@ -177,6 +169,5 @@ config UTF8 rsource "Kconfig.cbprintf" -rsource "Kconfig.heap" endmenu