From 874ecbe2f31e629e8f68701038b5c3a4e2d7a321 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 788ae473c8..ed6065c6a3 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 fail + 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 c681fa94a2..b44f98862f 100644 --- a/mm/mm_heap/Make.defs +++ b/mm/mm_heap/Make.defs @@ -20,6 +20,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 @@ -38,3 +40,5 @@ endif DEPPATH += --dep-path mm_heap VPATH += :mm_heap + +endif # CONFIG_MM_DEFAULT_MANAGER