1import os 2from building import * 3Import('rtconfig') 4 5group = [] 6 7if rtconfig.PLATFORM == 'gcc': 8 from gcc import * 9elif rtconfig.PLATFORM == 'llvm-arm': 10 from llvm_arm import * 11else: 12 Return('group') 13 14picolibc_version = GetPicoLibcVersion(rtconfig) 15 16if picolibc_version and not GetDepend('RT_USING_EXTERNAL_LIBC'): 17 print('PicoLibc version: ' + picolibc_version) 18 19 cwd = GetCurrentDir() 20 src = Glob('*.c') 21 22 CPPPATH = [cwd] 23 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 24 # LIBS = ['c', 'm'] # link libc and libm 25 AddDepend(['RT_USING_PICOLIBC', 'RT_USING_LIBC']) 26 27 group = group + DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)#, LIBS = LIBS) 28 29 list = os.listdir(cwd) 30 for d in list: 31 path = os.path.join(cwd, d) 32 if os.path.isfile(os.path.join(path, 'SConscript')): 33 group = group + SConscript(os.path.join(d, 'SConscript')) 34 35Return('group') 36