mm/umm: Allow customizing the implementation of umm heap

and migrate arch/sim from the customized mm_heap to
umm_heap, so the default mm_heap implementation can
still be used(e.g. shared memory in OpenAMP).

Signed-off-by: ganjing <ganjing@xiaomi.com>
This commit is contained in:
ganjing
2026-01-26 13:57:19 +08:00
committed by Xiang Xiao
parent 364a633ec3
commit e941b18e29
10 changed files with 209 additions and 300 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ config SIM_CYGWIN_DECORATED
config SIM_ASAN
bool "Address Sanitizer"
default n
depends on !MM_KASAN && MM_CUSTOMIZE_MANAGER && FRAME_POINTER
depends on !MM_KASAN && MM_UMM_CUSTOMIZE_MANAGER && FRAME_POINTER
---help---
AddressSanitizer (ASan) is a fast compiler-based tool for detecting memory
bugs in native code.
+1 -1
View File
@@ -81,7 +81,7 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sim_initialize.c sim_idle.c sim_doirq.c sim_initialstate.c
CSRCS += sim_createstack.c sim_usestack.c sim_releasestack.c sim_stackframe.c
CSRCS += sim_exit.c sim_switchcontext.c sim_heap.c
CSRCS += sim_exit.c sim_switchcontext.c sim_ummheap.c
CSRCS += sim_uart.c sim_copyfullstate.c sim_tcbinfo.c sim_cpuinfo.c
CSRCS += sim_registerdump.c sim_saveusercontext.c sim_sectionheap.c
CSRCS += sim_checkhostfstypes.c
+1 -1
View File
@@ -51,7 +51,7 @@ list(
sim_stackframe.c
sim_exit.c
sim_switchcontext.c
sim_heap.c
sim_ummheap.c
sim_uart.c
sim_copyfullstate.c
sim_registerdump.c
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -25,7 +25,7 @@ CONFIG_FS_PROCFS=y
CONFIG_INIT_ARGS="\"-c\", \"ostest;poweroff\""
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_MM_CUSTOMIZE_MANAGER=y
CONFIG_MM_UMM_CUSTOMIZE_MANAGER=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
+1 -1
View File
@@ -48,7 +48,7 @@ CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALE_GETTEXT=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_NUMBERED_ARGS=y
CONFIG_MM_CUSTOMIZE_MANAGER=y
CONFIG_MM_UMM_CUSTOMIZE_MANAGER=y
CONFIG_MTD=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_RAM=y
+1 -1
View File
@@ -47,7 +47,7 @@ CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALE_GETTEXT=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_NUMBERED_ARGS=y
CONFIG_MM_CUSTOMIZE_MANAGER=y
CONFIG_MM_UMM_CUSTOMIZE_MANAGER=y
CONFIG_MTD=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_RAM=y
+7
View File
@@ -25,6 +25,13 @@ config MM_CUSTOMIZE_MANAGER
endchoice
config MM_UMM_CUSTOMIZE_MANAGER
bool "Customized heap manager"
default n
---help---
Customized memory manager policy. The build will fail
if the umm heap module not defined by customer.
config MM_KERNEL_HEAP
bool "Kernel dedicated heap"
default BUILD_PROTECTED || BUILD_KERNEL
+26 -24
View File
@@ -22,29 +22,31 @@
# User heap allocator
set(SRCS
umm_globals.c
umm_initialize.c
umm_addregion.c
umm_malloc_size.c
umm_brkaddr.c
umm_calloc.c
umm_extend.c
umm_free.c
umm_mallinfo.c
umm_malloc.c
umm_memalign.c
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_memdump.c)
if(NOT CONFIG_MM_UMM_CUSTOMIZE_MANAGER)
set(SRCS
umm_globals.c
umm_initialize.c
umm_addregion.c
umm_malloc_size.c
umm_brkaddr.c
umm_calloc.c
umm_extend.c
umm_free.c
umm_mallinfo.c
umm_malloc.c
umm_memalign.c
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_memdump.c)
if(CONFIG_BUILD_KERNEL)
list(APPEND SRCS umm_sbrk.c)
if(CONFIG_BUILD_KERNEL)
list(APPEND SRCS umm_sbrk.c)
endif()
if(CONFIG_DEBUG_MM)
list(APPEND SRCS umm_checkcorruption.c)
endif()
target_sources(mm PRIVATE ${SRCS})
endif()
if(CONFIG_DEBUG_MM)
list(APPEND SRCS umm_checkcorruption.c)
endif()
target_sources(mm PRIVATE ${SRCS})
+2
View File
@@ -22,6 +22,7 @@
# User heap allocator
ifeq ($(CONFIG_MM_UMM_CUSTOMIZE_MANAGER),)
CSRCS += umm_globals.c umm_initialize.c umm_addregion.c umm_malloc_size.c
CSRCS += umm_brkaddr.c umm_calloc.c umm_extend.c umm_free.c umm_mallinfo.c
CSRCS += umm_malloc.c umm_memalign.c umm_realloc.c umm_zalloc.c umm_heapmember.c
@@ -39,3 +40,4 @@ endif
DEPPATH += --dep-path umm_heap
VPATH += :umm_heap
endif