diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/spi/SConscript | 2 | ||||
| -rw-r--r-- | components/libc/compilers/common/cstring.c | 2 | ||||
| -rw-r--r-- | components/libc/compilers/common/extension/SConscript | 2 | ||||
| -rw-r--r-- | components/libc/compilers/picolibc/README.md | 8 | ||||
| -rw-r--r-- | components/libc/compilers/picolibc/SConscript | 29 | ||||
| -rw-r--r-- | components/libc/compilers/picolibc/syscall.c | 16 |
6 files changed, 57 insertions, 2 deletions
diff --git a/components/drivers/spi/SConscript b/components/drivers/spi/SConscript index 27b7a8dd71..e84ed7bb06 100644 --- a/components/drivers/spi/SConscript +++ b/components/drivers/spi/SConscript @@ -29,7 +29,7 @@ if GetDepend('RT_USING_SFUD'): if GetDepend('RT_SFUD_USING_SFDP'): src_device += ['sfud/src/sfud_sfdp.c'] - if rtconfig.PLATFORM in ['gcc', 'armclang']: + if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: LOCAL_CFLAGS += ' -std=c99' elif rtconfig.PLATFORM in ['armcc']: LOCAL_CFLAGS += ' --c99' diff --git a/components/libc/compilers/common/cstring.c b/components/libc/compilers/common/cstring.c index 733433598e..59c516d273 100644 --- a/components/libc/compilers/common/cstring.c +++ b/components/libc/compilers/common/cstring.c @@ -19,10 +19,12 @@ * * @note The bzero() function is deprecated (marked as LEGACY in POSIX. 1-2001). */ +#ifndef RT_USING_PICOLIBC void bzero(void* s, size_t n) { rt_memset(s, 0, n); } +#endif void bcopy(const void* src, void* dest, size_t n) { diff --git a/components/libc/compilers/common/extension/SConscript b/components/libc/compilers/common/extension/SConscript index ddd83c8234..75bb23d18e 100644 --- a/components/libc/compilers/common/extension/SConscript +++ b/components/libc/compilers/common/extension/SConscript @@ -9,7 +9,7 @@ group = [] src += Glob('*.c') -if rtconfig.PLATFORM != 'gcc': +if rtconfig.PLATFORM != 'gcc' and rtconfig.PLATFORM != 'llvm-arm': group = DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH) list = os.listdir(cwd) diff --git a/components/libc/compilers/picolibc/README.md b/components/libc/compilers/picolibc/README.md new file mode 100644 index 0000000000..af766e7ca7 --- /dev/null +++ b/components/libc/compilers/picolibc/README.md @@ -0,0 +1,8 @@ +# PICOLIBC (LLVM-ARM) porting for RT-Thread + +https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm + +https://github.com/picolibc/picolibc + + + diff --git a/components/libc/compilers/picolibc/SConscript b/components/libc/compilers/picolibc/SConscript new file mode 100644 index 0000000000..999f7cca56 --- /dev/null +++ b/components/libc/compilers/picolibc/SConscript @@ -0,0 +1,29 @@ +import os +from building import * +from llvm_arm import * +Import('rtconfig') + +group = [] + +picolibc_version = GetPicoLibcVersion(rtconfig) + +if picolibc_version and not GetDepend('RT_USING_EXTERNAL_LIBC'): + print('PicoLibc version: ' + picolibc_version) + + cwd = GetCurrentDir() + src = Glob('*.c') + + CPPPATH = [cwd] + CPPDEFINES = ['RT_USING_PICOLIBC', 'RT_USING_LIBC', '_POSIX_C_SOURCE=1', '__PICOLIBC_ERRNO_FUNCTION=pico_get_errno'] # identify this is Newlib, and only enable POSIX.1-1990 + # LIBS = ['c', 'm'] # link libc and libm + AddDepend(['RT_USING_PICOLIBC', 'RT_USING_LIBC']) + + group = group + DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)#, LIBS = LIBS) + + list = os.listdir(cwd) + for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + group = group + SConscript(os.path.join(d, 'SConscript')) + +Return('group') diff --git a/components/libc/compilers/picolibc/syscall.c b/components/libc/compilers/picolibc/syscall.c new file mode 100644 index 0000000000..882964a1f3 --- /dev/null +++ b/components/libc/compilers/picolibc/syscall.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-05-17 Flybreak the first version + */ + +#include <rtthread.h> + +int pico_get_errno(void) +{ + return rt_get_errno(); +} |
