From ae8d4fd275d7280c6c1b36926d9c5f25d63307f8 Mon Sep 17 00:00:00 2001 From: arvinzzz Date: Fri, 28 Oct 2022 18:43:35 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E6=94=AF=E6=8C=81=E5=8E=82=E5=95=86?= =?UTF-8?q?=E5=AE=9A=E5=88=B6malloc=E6=9B=BF=E6=8D=A2=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit malloc的相关支持可以通过make menuconfig配置 close: #I5YBPE Signed-off-by: arvinzzz Change-Id: Ic40968aa83f43f539f7551c1dcec05f4f9832983 --- kal/libc/Kconfig | 1 + kal/libc/iccarm/Kconfig | 6 ++++++ kal/libc/newlib/Kconfig | 6 ++++++ kal/libc/newlib/porting/src/malloc.c | 2 ++ 4 files changed, 15 insertions(+) diff --git a/kal/libc/Kconfig b/kal/libc/Kconfig index 2b171549..34f3304e 100644 --- a/kal/libc/Kconfig +++ b/kal/libc/Kconfig @@ -43,6 +43,7 @@ rsource "newlib/Kconfig" config LIBC_ICCARM bool "iar libc" + depends on COMPILER_ICCARM rsource "iccarm/Kconfig" endchoice diff --git a/kal/libc/iccarm/Kconfig b/kal/libc/iccarm/Kconfig index 196d88ac..aa2790dc 100644 --- a/kal/libc/iccarm/Kconfig +++ b/kal/libc/iccarm/Kconfig @@ -35,4 +35,10 @@ config LIBC_ICCARM_FS help This enables POSIX style file system related APIs. +config LIBC_ICCARM_MALLOC + bool "Enable POSIX malloc/free API support" + default y + help + This enables POSIX malloc/free related APIs. + endif # LIBC_ICCARM diff --git a/kal/libc/newlib/Kconfig b/kal/libc/newlib/Kconfig index 3f3e92f7..0c38db35 100644 --- a/kal/libc/newlib/Kconfig +++ b/kal/libc/newlib/Kconfig @@ -36,4 +36,10 @@ config LIBC_NEWLIB_FS help This enables POSIX style file system related APIs. +config LIBC_NEWLIB_MALLOC + bool "Enable POSIX malloc/free API support" + default y + help + This enables POSIX malloc/free related APIs. + endif # LIBC_NEWLIB diff --git a/kal/libc/newlib/porting/src/malloc.c b/kal/libc/newlib/porting/src/malloc.c index ec8ef278..8e840d15 100644 --- a/kal/libc/newlib/porting/src/malloc.c +++ b/kal/libc/newlib/porting/src/malloc.c @@ -34,6 +34,7 @@ #include "los_memory.h" #include +#ifdef LOSCFG_LIBC_NEWLIB_MALLOC void *zalloc(size_t size) { void *ptr = NULL; @@ -111,3 +112,4 @@ void *__wrap__calloc_r(struct _reent *reent, size_t nitems, size_t size) } return ptr; } +#endif