feature: 支持厂商定制malloc替换系统默认实现

malloc的相关支持可以通过make menuconfig配置

close: #I5YBPE

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: Ic40968aa83f43f539f7551c1dcec05f4f9832983
This commit is contained in:
arvinzzz 2022-10-28 18:43:35 +08:00
parent 6e6cbe5de6
commit ae8d4fd275
4 changed files with 15 additions and 0 deletions

View File

@ -43,6 +43,7 @@ rsource "newlib/Kconfig"
config LIBC_ICCARM
bool "iar libc"
depends on COMPILER_ICCARM
rsource "iccarm/Kconfig"
endchoice

View File

@ -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

View File

@ -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

View File

@ -34,6 +34,7 @@
#include "los_memory.h"
#include <malloc.h>
#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