summaryrefslogtreecommitdiff
path: root/components/libc/compilers
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-06-12 18:11:51 +0800
committerMeco Man <[email protected]>2021-06-12 18:11:51 +0800
commit740a810274b9b9ccd74c4163fa9b11b5ee7f7926 (patch)
tree25275f6c00a20e7154c40376a16e547938877498 /components/libc/compilers
parentac3b3d13dd690537eddc3aa1f0df9872178daab4 (diff)
[errno][libc] 解决sys头文件在libc未开启时的引入问题
Diffstat (limited to 'components/libc/compilers')
-rw-r--r--components/libc/compilers/common/SConscript13
-rw-r--r--components/libc/compilers/common/none-gcc/SConscript6
-rw-r--r--components/libc/compilers/newlib/minilib.c14
3 files changed, 15 insertions, 18 deletions
diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript
index 039e53a0b3..2ebfc36c4e 100644
--- a/components/libc/compilers/common/SConscript
+++ b/components/libc/compilers/common/SConscript
@@ -9,20 +9,17 @@ CPPPATH = [cwd]
if GetDepend('RT_USING_LIBC'):
src += Glob('*.c')
-else:
- if GetDepend('RT_LIBC_USING_TIME'):
- src += ['time.c']
-
-if GetDepend('RT_USING_POSIX') == False:
- SrcRemove(src, ['unistd.c'])
+ if GetDepend('RT_USING_POSIX') == False:
+ SrcRemove(src, ['unistd.c'])
+elif GetDepend('RT_LIBC_USING_TIME'):
+ src += ['time.c']
if rtconfig.CROSS_TOOL == 'keil':
CPPDEFINES = ['__CLK_TCK=RT_TICK_PER_SECOND']
else:
CPPDEFINES = []
-if GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME'):
- group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
+group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
list = os.listdir(cwd)
for d in list:
diff --git a/components/libc/compilers/common/none-gcc/SConscript b/components/libc/compilers/common/none-gcc/SConscript
index c5838f8949..c766c8f82d 100644
--- a/components/libc/compilers/common/none-gcc/SConscript
+++ b/components/libc/compilers/common/none-gcc/SConscript
@@ -6,8 +6,10 @@ src = []
cwd = GetCurrentDir()
CPPPATH = [cwd]
group = []
-src += Glob('*.c')
+
+if GetDepend('RT_USING_LIBC'):
+ src += Glob('*.c')
if rtconfig.PLATFORM != 'gcc' or rtconfig.ARCH == 'sim':
- group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'], CPPPATH = CPPPATH)
+ group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/libc/compilers/newlib/minilib.c b/components/libc/compilers/newlib/minilib.c
index f6df38f67b..612554ca66 100644
--- a/components/libc/compilers/newlib/minilib.c
+++ b/components/libc/compilers/newlib/minilib.c
@@ -12,8 +12,9 @@
#include <rtthread.h>
#ifdef RT_USING_HEAP /* Memory routine */
-void *
-_malloc_r (struct _reent *ptr, size_t size)
+#include <sys/errno.h>
+
+void * _malloc_r (struct _reent *ptr, size_t size)
{
void* result;
@@ -26,8 +27,7 @@ _malloc_r (struct _reent *ptr, size_t size)
return result;
}
-void *
-_realloc_r (struct _reent *ptr, void *old, size_t newlen)
+void * _realloc_r (struct _reent *ptr, void *old, size_t newlen)
{
void* result;
@@ -53,15 +53,13 @@ void *_calloc_r (struct _reent *ptr, size_t size, size_t len)
return result;
}
-void
-_free_r (struct _reent *ptr, void *addr)
+void _free_r (struct _reent *ptr, void *addr)
{
rt_free (addr);
}
#else
-void *
-_sbrk_r(struct _reent *ptr, ptrdiff_t incr)
+void * _sbrk_r(struct _reent *ptr, ptrdiff_t incr)
{
return RT_NULL;
}