commit
63394f5d1b
|
@ -6,18 +6,21 @@ notifications:
|
|||
before_script:
|
||||
# travis has changed to 64-bit and we require 32-bit compatibility libraries
|
||||
- sudo apt-get update
|
||||
- "sudo apt-get -qq install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 || true"
|
||||
- "sudo apt-get -qq install clang gcc-multilib libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 libsdl-dev || true"
|
||||
- "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/arm-none-eabi/arm-2012.09-63-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/arm-2012.09/bin && /opt/arm-2012.09/bin/arm-none-eabi-gcc --version || true"
|
||||
- "[ $RTT_TOOL_CHAIN = 'sourcery-mips' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/mips-sde-elf/mips-2012.09-98-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/mips-2012.09/bin && /opt/mips-2012.09/bin/mips-sde-elf-gcc --version || true"
|
||||
- "[ $RTT_TOOL_CHAIN = 'sourcery-ppc' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/powerpc-eabi/freescale-2011.03-39-powerpc-eabi-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/freescale-2011.03/bin && /opt/freescale-2011.03/bin/powerpc-eabi-gcc --version || true"
|
||||
- "[ $RTT_TOOL_CHAIN = 'atmel-avr32' ] && curl -s http://www.atmel.com/images/avr32-gnu-toolchain-3.4.1.348-linux.any.x86.tar.gz | sudo tar xzf - -C /opt && export RTT_EXEC_PATH=/opt/avr32-gnu-toolchain-linux_x86/bin && /opt/avr32-gnu-toolchain-linux_x86/bin/avr32-gcc --version && curl -sO http://www.atmel.com/images/avr-headers-3.2.3.970.zip && unzip -qq avr-headers-3.2.3.970.zip -d bsp/$RTT_BSP || true"
|
||||
- export RTT_ROOT=`pwd`
|
||||
- export RTT_CC='gcc'
|
||||
- "[ x$RTT_CC == x ] && export RTT_CC='gcc' || true"
|
||||
- git clone --depth 1 https://github.com/RT-Thread/RTGUI.git $HOME/RTGUI
|
||||
- export RTT_RTGUI=$HOME/RTGUI/components/rtgui
|
||||
|
||||
script:
|
||||
- scons -C bsp/$RTT_BSP
|
||||
|
||||
env:
|
||||
- RTT_BSP='simulator' RTT_CC='clang-analyze' RTT_EXEC_PATH=/usr/share/clang/scan-build
|
||||
- RTT_BSP='at91sam9260' RTT_TOOL_CHAIN='sourcery-arm'
|
||||
- RTT_BSP='avr32uc3b0' RTT_TOOL_CHAIN='atmel-avr32'
|
||||
# - RTT_BSP='bf533' # no scons
|
||||
|
|
|
@ -73,6 +73,10 @@ elif rtconfig.PLATFORM == 'mingw':
|
|||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env['LIBS']=libs
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
elif rtconfig.CROSS_TOOL == 'clang-analyze':
|
||||
TARGET = 'rtthread'
|
||||
env = Environment(toolpath=[os.path.join(RTT_ROOT, 'tools', 'tools')],
|
||||
tools = [rtconfig.CROSS_TOOL])
|
||||
else:
|
||||
TARGET = 'rtthread'
|
||||
env['CC']=rtconfig.CC
|
||||
|
@ -84,13 +88,6 @@ else:
|
|||
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui'])
|
||||
if GetDepend('RT_USING_RTGUI'):
|
||||
sdl_lib = ['SDL', 'SDLmain']
|
||||
sdl_lib_path = [os.path.abspath('SDL/lib/x86')]
|
||||
sdl_include_path = [os.path.abspath('SDL/include')]
|
||||
env.Append(LIBS=sdl_lib)
|
||||
env.Append(LIBPATH=sdl_lib_path)
|
||||
env.Append(CPPPATH=sdl_include_path)
|
||||
|
||||
if RTT_RTGUI:
|
||||
objs += SConscript(os.path.join(RTT_RTGUI, 'SConscript'),
|
||||
variant_dir='build/components/rtgui',
|
||||
|
|
|
@ -3,10 +3,19 @@ from building import *
|
|||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
LIBS = []
|
||||
LIBPATH = []
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# remove no need file.
|
||||
if GetDepend('RT_USING_RTGUI') == False:
|
||||
SrcRemove(src, 'sdl_fb.c')
|
||||
else:
|
||||
LIBS.append('SDL')
|
||||
if sys.platform == 'win32':
|
||||
LIBPATH.append(os.path.abspath(os.path.join(cwd, '../SDL/lib/x86')))
|
||||
CPPPATH.append(os.path.abspath(os.path.join(cwd, '../SDL/include')))
|
||||
|
||||
if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_DFS_ELMFAT') == False:
|
||||
SrcRemove(src, 'sd_sim.c')
|
||||
if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_MTD_NAND') == False:
|
||||
|
@ -20,8 +29,7 @@ if GetDepend('RT_USING_MODULE') == False:
|
|||
if sys.platform[0:5]=="linux": #check whether under linux
|
||||
SrcRemove(src, ['module_win32.c', 'dfs_win32.c'])
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
group = DefineGroup('Drivers', src, depend = [''],
|
||||
CPPPATH = CPPPATH, LIBS=LIBS, LIBPATH=LIBPATH)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
# toolchains options
|
||||
ARCH='sim'
|
||||
#CROSS_TOOL='msvc' or 'gcc' or 'mingw'
|
||||
|
@ -5,12 +7,15 @@ ARCH='sim'
|
|||
# 'gcc' is for linux
|
||||
CROSS_TOOL='msvc'
|
||||
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
# cross_tool provides the cross compiler
|
||||
# EXEC_PATH is the compiler execute path
|
||||
if CROSS_TOOL == 'gcc':
|
||||
if CROSS_TOOL == 'gcc' or CROSS_TOOL == 'clang-analyze':
|
||||
CPU = 'posix'
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = '/usr/bin/gcc'
|
||||
EXEC_PATH = ''
|
||||
|
||||
elif CROSS_TOOL == 'mingw':
|
||||
CPU = 'win32'
|
||||
|
@ -21,11 +26,13 @@ elif CROSS_TOOL == 'msvc':
|
|||
CPU = 'win32'
|
||||
PLATFORM = 'cl'
|
||||
EXEC_PATH = ''
|
||||
|
||||
else:
|
||||
print "bad CROSS TOOL!"
|
||||
exit(1)
|
||||
|
||||
if os.getenv('RTT_EXEC_PATH'):
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
BUILD = 'debug'
|
||||
#BUILD = ''
|
||||
|
||||
|
|
|
@ -113,8 +113,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||
AS = 'true',)
|
||||
env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
|
||||
# only check, don't compile. ccc-analyzer use CCC_CC as the CC.
|
||||
env['ENV']['CCC_CC'] = 'true'
|
||||
env['ENV']['CCC_CXX'] = 'true'
|
||||
# fsyntax-only will give us some additional warning messages
|
||||
env['ENV']['CCC_CC'] = 'clang'
|
||||
env.Append(CFLAGS=['-fsyntax-only', '-Wall', '-Wno-invalid-source-encoding'])
|
||||
env['ENV']['CCC_CXX'] = 'clang++'
|
||||
env.Append(CXXFLAGS=['-fsyntax-only', '-Wall', '-Wno-invalid-source-encoding'])
|
||||
# remove the POST_ACTION as it will cause meaningless errors(file not
|
||||
# found or something like that).
|
||||
rtconfig.POST_ACTION = ''
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
"""
|
||||
Tool-specific initialization for Clang static analyzer
|
||||
|
||||
There normally shouldn't be any need to import this module directly.
|
||||
It will usually be imported through the generic SCons.Tool.Tool()
|
||||
selection method.
|
||||
"""
|
||||
|
||||
__revision__ = "tools/clang-analyze.py 2013-09-06 grissiom"
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Builder
|
||||
import SCons.Defaults
|
||||
import SCons.Tool
|
||||
import SCons.Util
|
||||
|
||||
import rtconfig
|
||||
|
||||
def generate(env):
|
||||
assert(rtconfig.CROSS_TOOL == 'clang-analyze')
|
||||
# let gnu_tools setup a basic env(learnt from SCons/Tools/mingw.py)
|
||||
gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'm4']
|
||||
for tool in gnu_tools:
|
||||
SCons.Tool.Tool(tool)(env)
|
||||
|
||||
# then we could stand on the shoulders of gaints
|
||||
env['CC'] = 'ccc-analyzer'
|
||||
env['CXX'] = 'c++-analyzer'
|
||||
env['AS'] = 'true'
|
||||
env['AR'] = 'true'
|
||||
env['LINK'] = 'true'
|
||||
|
||||
env['CFLAGS'] = ['-fsyntax-only', '-Wall', '-Wno-invalid-source-encoding']
|
||||
env['LINKFLAGS'] = '-Wl,--gc-sections'
|
||||
env['ARFLAGS'] = '-rc'
|
||||
|
||||
# only check, don't compile. ccc-analyzer use CCC_CC as the CC.
|
||||
# fsyntax-only will give us some additional warning messages
|
||||
env['ENV']['CCC_CC'] = 'clang'
|
||||
env['ENV']['CCC_CXX'] = 'clang++'
|
||||
|
||||
# setup the output dir and format
|
||||
env['ENV']['CCC_ANALYZER_HTML'] = './build/'
|
||||
env['ENV']['CCC_ANALYZER_OUTPUT_FORMAT'] = 'html'
|
||||
|
||||
# Some setting from the platform also have to be overridden:
|
||||
env['OBJSUFFIX'] = '.o'
|
||||
env['LIBPREFIX'] = 'lib'
|
||||
env['LIBSUFFIX'] = '.a'
|
||||
|
||||
if rtconfig.EXEC_PATH:
|
||||
if not os.path.exists(rtconfig.EXEC_PATH):
|
||||
print
|
||||
print 'warning: rtconfig.EXEC_PATH(%s) does not exists.' % rtconfig.EXEC_PATH
|
||||
print
|
||||
return
|
||||
env.AppendENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
def exists(env):
|
||||
return env.Detect(['ccc-analyzer', 'c++-analyzer'])
|
||||
|
||||
# Local Variables:
|
||||
# tab-width:4
|
||||
# indent-tabs-mode:nil
|
||||
# End:
|
||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
Loading…
Reference in New Issue