From 15fc1cb23fdceed1c0b8984aa59e7b605510f80c Mon Sep 17 00:00:00 2001 From: mage1 Date: Wed, 3 Mar 2021 14:13:37 +0800 Subject: [PATCH] mm: add kconfig option to control the memory manger strategy choice. since will will porvide more the one strategy in future. Change-Id: I73b900c6571f9b71b8239dd72006bdd0a68ee64d --- mm/Kconfig | 17 +++++++++++++++++ mm/mm_heap/Make.defs | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 788ae473c87..bfd9204031c 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -3,6 +3,23 @@ # see the file kconfig-language.txt in the NuttX tools repository. # +choice + prompt "Build heap manager" + default MM_DEFAULT_MANAGER + +config MM_DEFAULT_MANAGER + bool "Default heap manager" + ---help--- + NuttX original memory manager strategy. + +config MM_CUSTOMIZE_MANAGER + bool "Customized heap manager" + ---help--- + Customized memory manger policy. The build will failed + if the MM heap module not defined by customer. + +endchoice + config MM_KERNEL_HEAP bool "Support a protected, kernel heap" default y diff --git a/mm/mm_heap/Make.defs b/mm/mm_heap/Make.defs index cd2879fa90f..df80cb0891f 100644 --- a/mm/mm_heap/Make.defs +++ b/mm/mm_heap/Make.defs @@ -35,6 +35,8 @@ # Core heap allocator logic +ifeq ($(CONFIG_MM_DEFAULT_MANAGER),y) + CSRCS += mm_initialize.c mm_sem.c mm_addfreechunk.c mm_size2ndx.c CSRCS += mm_malloc_usable_size.c mm_shrinkchunk.c CSRCS += mm_brkaddr.c mm_calloc.c mm_extend.c mm_free.c mm_mallinfo.c @@ -53,3 +55,5 @@ endif DEPPATH += --dep-path mm_heap VPATH += :mm_heap + +endif # CONFIG_MM_DEFAULT_MANAGER