diff --git a/bsp/ls1bdev/Kconfig b/bsp/ls1bdev/Kconfig index c9196af29d85209f0558378a756a729c26e56f44..b02aee337a32bf2320c7258c067ca2e9e07b3b7e 100644 --- a/bsp/ls1bdev/Kconfig +++ b/bsp/ls1bdev/Kconfig @@ -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 diff --git a/bsp/ls1cdev/Kconfig b/bsp/ls1cdev/Kconfig index 59f7c4332317a6f31c0dcce30aa2580c13e4760d..3fb6e3bbdf174662dc4c892c3cb17bed78429ef5 100644 --- a/bsp/ls1cdev/Kconfig +++ b/bsp/ls1cdev/Kconfig @@ -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 diff --git a/bsp/ls2kdev/Kconfig b/bsp/ls2kdev/Kconfig index 57dd99e53abb9e56ecc4056a08c4b7ee8dccafa8..fc2dfe1328d737567872f1a19da4e0e70d259286 100644 --- a/bsp/ls2kdev/Kconfig +++ b/bsp/ls2kdev/Kconfig @@ -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 diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 86985c561cb11752b4325b33ee0f90356366b402..18182ca2646a094587c3cb9ad2c985550f06ce24 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -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) diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index 7d8ec2e8b44e5e0501aa2daf9cf5512f5a47e0c6..3b1627d82a8220433dd828b03d013b13e9b6d3f4 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -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 diff --git a/components/libc/compilers/common/partial/ls/SConscript b/components/libc/compilers/common/partial/ls/SConscript deleted file mode 100644 index 2665bee0787a893a116698bc62913fe7121457ce..0000000000000000000000000000000000000000 --- a/components/libc/compilers/common/partial/ls/SConscript +++ /dev/null @@ -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') diff --git a/components/libc/compilers/common/partial/ls/readme.md b/components/libc/compilers/common/partial/ls/readme.md deleted file mode 100644 index fa68e1e84a43a7f3f2efdfd9b6437d95a3b24a78..0000000000000000000000000000000000000000 --- a/components/libc/compilers/common/partial/ls/readme.md +++ /dev/null @@ -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 \ No newline at end of file diff --git a/components/libc/compilers/common/stdlib.c b/components/libc/compilers/common/stdlib.c index 16a13afb83a3916ec6605dc251c547c59f74fb7a..6cc0b9fdacd199a32e030829ec7551747810bdec 100644 --- a/components/libc/compilers/common/stdlib.c +++ b/components/libc/compilers/common/stdlib.c @@ -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 diff --git a/components/libc/compilers/dlib/syscalls.c b/components/libc/compilers/dlib/syscalls.c index e1c9562b3a81bab6a3b71d16db6974692e144ad7..1ee6a3bc12ba4b10193a2896e03af7afb96af3ca 100644 --- a/components/libc/compilers/dlib/syscalls.c +++ b/components/libc/compilers/dlib/syscalls.c @@ -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 @@ -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); -} diff --git a/components/libc/compilers/common/partial/SConscript b/components/libc/compilers/gcc/SConscript similarity index 100% rename from components/libc/compilers/common/partial/SConscript rename to components/libc/compilers/gcc/SConscript diff --git a/components/libc/compilers/newlib/README.md b/components/libc/compilers/gcc/newlib/README.md similarity index 71% rename from components/libc/compilers/newlib/README.md rename to components/libc/compilers/gcc/newlib/README.md index 385f329a4f3600832055a94fac6eaad270e2b033..62172e6a5566673e1649acf8e64a18c1e56a7317 100644 --- a/components/libc/compilers/newlib/README.md +++ b/components/libc/compilers/gcc/newlib/README.md @@ -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 \ No newline at end of file +https://sourceware.org/newlib/libc.html#Reentrancy + diff --git a/components/libc/compilers/newlib/SConscript b/components/libc/compilers/gcc/newlib/SConscript similarity index 100% rename from components/libc/compilers/newlib/SConscript rename to components/libc/compilers/gcc/newlib/SConscript diff --git a/components/libc/compilers/newlib/libc.c b/components/libc/compilers/gcc/newlib/libc.c similarity index 100% rename from components/libc/compilers/newlib/libc.c rename to components/libc/compilers/gcc/newlib/libc.c diff --git a/components/libc/compilers/newlib/libc.h b/components/libc/compilers/gcc/newlib/libc.h similarity index 100% rename from components/libc/compilers/newlib/libc.h rename to components/libc/compilers/gcc/newlib/libc.h diff --git a/components/libc/compilers/newlib/libc_syms.c b/components/libc/compilers/gcc/newlib/libc_syms.c similarity index 100% rename from components/libc/compilers/newlib/libc_syms.c rename to components/libc/compilers/gcc/newlib/libc_syms.c diff --git a/components/libc/compilers/newlib/machine/time.h b/components/libc/compilers/gcc/newlib/machine/time.h similarity index 100% rename from components/libc/compilers/newlib/machine/time.h rename to components/libc/compilers/gcc/newlib/machine/time.h diff --git a/components/libc/compilers/newlib/stdio.c b/components/libc/compilers/gcc/newlib/stdio.c similarity index 100% rename from components/libc/compilers/newlib/stdio.c rename to components/libc/compilers/gcc/newlib/stdio.c diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/gcc/newlib/syscalls.c similarity index 97% rename from components/libc/compilers/newlib/syscalls.c rename to components/libc/compilers/gcc/newlib/syscalls.c index 4c1dc82ad376313b69e20b59d9009dcf0e6bf673..f5a2c16ecc774e36d30bb5e62a87e717712ff9b0 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/gcc/newlib/syscalls.c @@ -85,6 +85,7 @@ void __libc_init_array(void) #ifdef RT_USING_LIBC #include #include +#include "libc.h" #ifdef RT_USING_DFS #include #endif @@ -92,10 +93,6 @@ void __libc_init_array(void) #include #endif -#define DBG_TAG "newlib.syscalls" -#define DBG_LVL DBG_INFO -#include - /* 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) { diff --git a/components/libc/compilers/gcc/partial/SConscript b/components/libc/compilers/gcc/partial/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..4c815c49b835a3a5ea61f337dc17154dd316d7d1 --- /dev/null +++ b/components/libc/compilers/gcc/partial/SConscript @@ -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') diff --git a/components/libc/compilers/gcc/partial/mips/SConscript b/components/libc/compilers/gcc/partial/mips/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..7651233d461ca15f48ccaf4010e45bc6b8fe345a --- /dev/null +++ b/components/libc/compilers/gcc/partial/mips/SConscript @@ -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') diff --git a/components/libc/compilers/gcc/partial/mips/readme.md b/components/libc/compilers/gcc/partial/mips/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..a3eeb06c5dae22c3e2b40eb0a54902be23891ed7 --- /dev/null +++ b/components/libc/compilers/gcc/partial/mips/readme.md @@ -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 + diff --git a/components/libc/compilers/common/partial/ls/sys/select.h b/components/libc/compilers/gcc/partial/mips/sys/select.h similarity index 100% rename from components/libc/compilers/common/partial/ls/sys/select.h rename to components/libc/compilers/gcc/partial/mips/sys/select.h diff --git a/components/libc/compilers/gcc/partial/readme.md b/components/libc/compilers/gcc/partial/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..959fc29f35c4c1fbb3bdeac9f924aa6a3886934d --- /dev/null +++ b/components/libc/compilers/gcc/partial/readme.md @@ -0,0 +1,2 @@ +This folder is for some particular targets. +