kernel: add kconfig CONFIG_KERNEL_MEM_POOL

Adds a kconfig CONFIG_KERNEL_MEM_POOL to decide whether
kernel memory pool related code is compiled. This option
can be disabled to shrink code size. If k_heap is not
being used at all, kheap.c will also not be compiled,
resulting in further smaller code size.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-09-18 14:12:51 -07:00 committed by Anas Nashif
commit b5c2ff9397
2 changed files with 20 additions and 4 deletions

View file

@ -11,7 +11,6 @@ add_library(kernel
kheap.c
mailbox.c
mem_slab.c
mempool.c
msg_q.c
mutex.c
pipes.c
@ -42,9 +41,13 @@ target_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_C kernel PRIVATE atomic_c.c)
target_sources_ifdef(CONFIG_MMU kernel PRIVATE mmu.c)
target_sources_ifdef(CONFIG_POLL kernel PRIVATE poll.c)
if(${CONFIG_MEM_POOL_HEAP_BACKEND})
else()
target_sources(kernel PRIVATE mempool_sys.c)
if(${CONFIG_KERNEL_MEM_POOL})
target_sources(kernel PRIVATE mempool.c)
if(${CONFIG_MEM_POOL_HEAP_BACKEND})
else()
target_sources(kernel PRIVATE mempool_sys.c)
endif()
endif()
# The last 2 files inside the target_sources_ifdef should be