Merge pull request #5105 from mysterywolf/part

[libc]新建gcc文件夹,将newlib和partical文件夹并入
This commit is contained in:
Bernard Xiong 2021-09-28 13:48:39 +08:00 committed by GitHub
commit d43a68e95e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 59 additions and 92 deletions

View File

@ -18,10 +18,6 @@ config PKGS_DIR
source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
config SOC_LS
bool
default y
config SOC_LS1B
bool
select RT_USING_COMPONENTS_INIT

View File

@ -19,10 +19,6 @@ source "$RTT_DIR/Kconfig"
source "$RTT_DIR/libcpu/mips/common/Kconfig"
source "$PKGS_DIR/Kconfig"
config SOC_LS
bool
default y
config SOC_LS1C300
bool
select RT_USING_COMPONENTS_INIT

View File

@ -22,10 +22,6 @@ source "$RTT_DIR/Kconfig"
source "$RTT_DIR/libcpu/mips/common/Kconfig"
source "$PKGS_DIR/Kconfig"
config SOC_LS
bool
default y
config SOC_LS2K1000
bool
select ARCH_MIPS64

View File

@ -257,21 +257,6 @@ int msh_exec_module(const char *cmd_line, int size)
rt_free(pg_name);
return ret;
}
int system(const char *command)
{
int ret = -RT_ENOMEM;
char *cmd = rt_strdup(command);
if (cmd)
{
ret = msh_exec(cmd, rt_strlen(cmd));
rt_free(cmd);
}
return ret;
}
RTM_EXPORT(system);
#endif /* defined(RT_USING_MODULE) && defined(RT_USING_DFS) */
static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp)

View File

@ -319,16 +319,6 @@ int remove(const char *filename)
#endif
}
#if defined(RT_USING_FINSH) && defined(RT_USING_MODULE) && defined(RT_USING_DFS)
/* use system(const char *string) implementation in the msh */
#else
int system(const char *string)
{
extern int __rt_libc_system(const char *string);
return __rt_libc_system(string);
}
#endif
#ifdef __MICROLIB
#include <stdio.h>

View File

@ -1,23 +0,0 @@
from shutil import copy
from building import *
Import('rtconfig')
src = []
cwd = GetCurrentDir()
CPPPATH = [cwd]
group = []
if rtconfig.PLATFORM == 'gcc' and GetDepend('SOC_LS'):
try:
# There is no 'sys/select.h' in these bsp's gcc toolchain; thus, we need to copy this file from 'nogcc/sys/select.h'
copy("../../nogcc/sys/select.h", "./sys/select.h")
except:
pass
if GetDepend('RT_USING_LIBC'):
src += Glob('*.c')
group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH)
Return('group')

View File

@ -1,9 +0,0 @@
This folder will be included when compiling the BSPs as follow:
- ls1bdev
- ls1cdev
- ls2kdev
These files will be generated by scons automatically , and **DO NOT** change them:
- sys/select.h

View File

@ -25,11 +25,21 @@ void __rt_libc_exit(int status)
}
}
int __rt_libc_system(const char *string)
{
#ifdef RT_USING_MSH
int system(const char *command)
{
extern int msh_exec(char *cmd, rt_size_t length);
msh_exec((char*)string, rt_strlen(string));
#endif
return 0;
int ret = -RT_ENOMEM;
char *cmd = rt_strdup(command);
if (cmd)
{
ret = msh_exec(cmd, rt_strlen(cmd));
rt_free(cmd);
}
return ret;
}
RTM_EXPORT(system);
#endif

View File

@ -6,7 +6,6 @@
* Change Logs:
* Date Author Notes
* 2021-02-13 Meco Man implement exit() and abort()
* 2021-02-20 Meco Man add system()
*/
#include <rtthread.h>
@ -17,9 +16,3 @@ void __exit (int status)
__rt_libc_exit(status);
while(1);
}
int system(const char * string)
{
extern int __rt_libc_system(const char *string);
return __rt_libc_system(string);
}

View File

@ -6,4 +6,5 @@ Please define RT_USING_LIBC and compile RT-Thread with GCC compiler.
## More Information
https://sourceware.org/newlib/libc.html#Reentrancy
https://sourceware.org/newlib/libc.html#Reentrancy

View File

@ -85,6 +85,7 @@ void __libc_init_array(void)
#ifdef RT_USING_LIBC
#include <reent.h>
#include <stdio.h>
#include "libc.h"
#ifdef RT_USING_DFS
#include <dfs_posix.h>
#endif
@ -92,10 +93,6 @@ void __libc_init_array(void)
#include <dlmodule.h>
#endif
#define DBG_TAG "newlib.syscalls"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
/* Reentrant versions of system calls. */
#ifndef _REENT_ONLY
@ -311,12 +308,6 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
#endif
}
void _system(const char *s)
{
extern int __rt_libc_system(const char *string);
__rt_libc_system(s);
}
/* for exit() and abort() */
__attribute__ ((noreturn)) void _exit (int status)
{

View File

@ -0,0 +1,15 @@
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')

View File

@ -0,0 +1,20 @@
from shutil import copy
from building import *
Import('rtconfig')
src = []
cwd = GetCurrentDir()
CPPPATH = [cwd]
group = []
if rtconfig.PLATFORM == 'gcc' and ('mips' in rtconfig.PREFIX): # identify mips gcc tool chain
try:
# There is no 'sys/select.h' in tthe mips gcc toolchain; it will be copied from 'nogcc/sys/select.h'
copy("../../../common/nogcc/sys/select.h", "./sys/select.h")
except:
pass
group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,4 @@
These files don't exist in the mips gcc toolchain. They will be generated by scons automatically , and **DO NOT** change them:
- sys/select.h

View File

@ -0,0 +1,2 @@
This folder is for some particular targets.