提交 30c793fd 编写于 作者: mysterywolf's avatar mysterywolf

[tools] add GetGCCLikePLATFORM

GCC like means the toolchains which are compatible with GCC
上级 290678b6
...@@ -3,6 +3,7 @@ import os ...@@ -3,6 +3,7 @@ import os
Import('RTT_ROOT') Import('RTT_ROOT')
Import('rtconfig') Import('rtconfig')
from building import * from building import *
from gcc import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = [] src = []
...@@ -12,7 +13,7 @@ list = os.listdir(cwd) ...@@ -12,7 +13,7 @@ list = os.listdir(cwd)
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: elif rtconfig.PLATFORM in GetGCCLikePLATFORM():
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
CPPPATH = [cwd] CPPPATH = [cwd]
src = Glob('./src/*.c') src = Glob('./src/*.c')
......
Import('RTT_ROOT') Import('RTT_ROOT')
Import('rtconfig') Import('rtconfig')
from building import * from building import *
from gcc import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = [] src = []
...@@ -10,7 +11,7 @@ CPPPATH = [] ...@@ -10,7 +11,7 @@ CPPPATH = []
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: elif rtconfig.PLATFORM in GetGCCLikePLATFORM():
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
src += Glob(cwd + '/fsp/src/bsp/mcu/all/*.c') src += Glob(cwd + '/fsp/src/bsp/mcu/all/*.c')
src += [cwd + '/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c'] src += [cwd + '/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c']
......
Import('RTT_ROOT') Import('RTT_ROOT')
Import('rtconfig') Import('rtconfig')
from building import * from building import *
from gcc import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = [] src = []
...@@ -10,7 +11,7 @@ CPPPATH = [] ...@@ -10,7 +11,7 @@ CPPPATH = []
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: elif rtconfig.PLATFORM in GetGCCLikePLATFORM():
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [cwd+'/fsp_cfg', cwd + '/fsp_cfg/bsp'] CPPPATH = [cwd+'/fsp_cfg', cwd + '/fsp_cfg/bsp']
......
Import('RTT_ROOT') Import('RTT_ROOT')
Import('rtconfig') Import('rtconfig')
from building import * from building import *
from gcc import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = [] src = []
...@@ -10,7 +11,7 @@ CPPPATH = [] ...@@ -10,7 +11,7 @@ CPPPATH = []
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: elif rtconfig.PLATFORM in GetGCCLikePLATFORM():
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [cwd, ] CPPPATH = [cwd, ]
......
from building import * from building import *
from gcc import *
import rtconfig import rtconfig
cwd = GetCurrentDir() cwd = GetCurrentDir()
...@@ -29,7 +30,7 @@ if GetDepend('RT_USING_SFUD'): ...@@ -29,7 +30,7 @@ if GetDepend('RT_USING_SFUD'):
if GetDepend('RT_SFUD_USING_SFDP'): if GetDepend('RT_SFUD_USING_SFDP'):
src_device += ['sfud/src/sfud_sfdp.c'] src_device += ['sfud/src/sfud_sfdp.c']
if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: if rtconfig.PLATFORM in GetGCCLikePLATFORM():
LOCAL_CFLAGS += ' -std=c99' LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']: elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99' LOCAL_CFLAGS += ' --c99'
......
from building import * from building import *
from gcc import *
import os import os
Import('rtconfig') Import('rtconfig')
...@@ -7,8 +8,7 @@ src = ['cxx_crt_init.c', 'cxx_crt.cpp'] ...@@ -7,8 +8,7 @@ src = ['cxx_crt_init.c', 'cxx_crt.cpp']
CPPPATH = [cwd] CPPPATH = [cwd]
CXXFLAGS = '' CXXFLAGS = ''
if rtconfig.PLATFORM in GetGCCLikePLATFORM() and not GetDepend('RT_USING_CPP_EXCEPTIONS'):
if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm'] and not GetDepend('RT_USING_CPP_EXCEPTIONS'):
CXXFLAGS += ' -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections' # reduce resource consumptions CXXFLAGS += ' -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections' # reduce resource consumptions
group = DefineGroup('CPP', src, depend=['RT_USING_CPLUSPLUS'], CPPPATH=CPPPATH, CXXFLAGS=CXXFLAGS) group = DefineGroup('CPP', src, depend=['RT_USING_CPLUSPLUS'], CPPPATH=CPPPATH, CXXFLAGS=CXXFLAGS)
......
...@@ -66,6 +66,10 @@ def CheckHeader(rtconfig, filename): ...@@ -66,6 +66,10 @@ def CheckHeader(rtconfig, filename):
return False return False
# GCC like means the toolchains which are compatible with GCC
def GetGCCLikePLATFORM():
return ['gcc', 'armclang', 'llvm-arm']
def GetNewLibVersion(rtconfig): def GetNewLibVersion(rtconfig):
version = None version = None
root = GetGCCRoot(rtconfig) root = GetGCCRoot(rtconfig)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册