feature: 支持厂商定制malloc替换系统默认实现
malloc的相关支持可以通过make menuconfig配置 close: #I5YBPE Signed-off-by: arvinzzz <zhaotianyu9@huawei.com> Change-Id: Ic40968aa83f43f539f7551c1dcec05f4f9832983
This commit is contained in:
parent
6e6cbe5de6
commit
ae8d4fd275
|
@ -43,6 +43,7 @@ rsource "newlib/Kconfig"
|
||||||
|
|
||||||
config LIBC_ICCARM
|
config LIBC_ICCARM
|
||||||
bool "iar libc"
|
bool "iar libc"
|
||||||
|
depends on COMPILER_ICCARM
|
||||||
rsource "iccarm/Kconfig"
|
rsource "iccarm/Kconfig"
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
|
@ -35,4 +35,10 @@ config LIBC_ICCARM_FS
|
||||||
help
|
help
|
||||||
This enables POSIX style file system related APIs.
|
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
|
endif # LIBC_ICCARM
|
||||||
|
|
|
@ -36,4 +36,10 @@ config LIBC_NEWLIB_FS
|
||||||
help
|
help
|
||||||
This enables POSIX style file system related APIs.
|
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
|
endif # LIBC_NEWLIB
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "los_memory.h"
|
#include "los_memory.h"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
#ifdef LOSCFG_LIBC_NEWLIB_MALLOC
|
||||||
void *zalloc(size_t size)
|
void *zalloc(size_t size)
|
||||||
{
|
{
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
|
@ -111,3 +112,4 @@ void *__wrap__calloc_r(struct _reent *reent, size_t nitems, size_t size)
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue