add scons script.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1089 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
lijin.unix@gmail.com 2010-11-22 07:21:28 +00:00
parent 8abbd39962
commit 913a4edfb3
4 changed files with 160 additions and 75 deletions

18
bsp/lpc2478/SConscript Normal file
View File

@ -0,0 +1,18 @@
import rtconfig
Import('RTT_ROOT')
from building import *
src_bsp = ['application.c', 'startup.c', 'board.c']
src_drv = []
if GetDepend('RT_USING_DFS'):
src_drv += ['sd.c', 'spi.c']
if GetDepend('RT_USING_LWIP'):
src_drv += ['emac.c']
src = File(src_bsp + src_drv)
CPPPATH = [RTT_ROOT + '/bsp/lpc2478']
group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -1,11 +1,12 @@
import os import os
import sys
import rtconfig import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
target = 'rtthread-lpc2478' sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *
# search path for C compiler TARGET = 'rtthread-lpc2478.' + rtconfig.TARGET_EXT
bsp_path = RTT_ROOT + '/bsp/lpc2478'
env = Environment(tools = ['mingw'], env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
@ -13,44 +14,24 @@ env = Environment(tools = ['mingw'],
AR = rtconfig.AR, ARFLAGS = '-rc', AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH) env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
env.AppendUnique(CPPPATH = bsp_path)
env.AppendUnique(CCFLAGS = ' -DUSE_STDPERIPH_DRIVER -DSTM32F10X_HD')
Export('env')
Export('RTT_ROOT') Export('RTT_ROOT')
Export('rtconfig') Export('rtconfig')
objs = SConscript(RTT_ROOT + '/src/SConscript', variant_dir='build/src', duplicate=0) # prepare building environment
objs = objs + SConscript(RTT_ROOT + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0) objs = PrepareBuilding(env, RTT_ROOT)
if rtconfig.RT_USING_MINILIBC: if GetDepend('RT_USING_WEBSERVER'):
objs = objs + SConscript(RTT_ROOT + '/libc/minilibc/SConscript', variant_dir='build/minilibc', duplicate=0) objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
if rtconfig.RT_USING_FINSH: if GetDepend('RT_USING_RTGUI'):
objs = objs + SConscript(RTT_ROOT + '/finsh/SConscript', variant_dir='build/finsh', duplicate=0) objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
if rtconfig.RT_USING_DFS: # libc testsuite
objs = objs + SConscript(RTT_ROOT + '/filesystem/dfs/SConscript', variant_dir='build/filesystem', duplicate=0) # objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
if rtconfig.RT_USING_LWIP: # build program
objs = objs + SConscript(RTT_ROOT + '/net/lwip/SConscript', variant_dir='build/net/lwip', duplicate=0)
if rtconfig.RT_USING_RTGUI:
objs = objs + SConscript(RTT_ROOT + '/rtgui/SConscript', variant_dir='build/rtgui', duplicate=0)
src_bsp = ['application.c', 'startup.c', 'board.c' ]
if rtconfig.RT_USING_DFS:
src_drv += ['sdcard.c']
if rtconfig.RT_USING_LWIP:
src_drv += ['dm9000.c']
if rtconfig.RT_USING_RTGUI:
src_drv += ['touch.c']
objs = objs + env.Object(src_bsp )
TARGET = target + '.' + rtconfig.TARGET_EXT
env.Program(TARGET, objs) env.Program(TARGET, objs)
env.AddPostAction(TARGET, rtconfig.POST_ACTION)
# end building
EndBuilding(TARGET)

View File

@ -1,29 +1,15 @@
# component options
# finsh shell option
RT_USING_FINSH = True
# device file system options
RT_USING_DFS = False
RT_USING_DFS_EFSL = False
RT_USING_DFS_ELMFAT = False
RT_USING_DFS_YAFFS2 = False
# lwip options
RT_USING_LWIP = False
# rtgui options
RT_USING_RTGUI = False
# toolchains options # toolchains options
ARCH='arm' ARCH='arm'
CPU='lpc24xx' CPU='lpc2478'
TextBase='0x30000000' CROSS_TOOL='keil'
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = 'D:/SourceryGCC/bin'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = 'd:/Keil'
#PLATFORM = 'gcc'
#EXEC_PATH = 'd:/SourceryGCC/bin'
PLATFORM = 'armcc'
EXEC_PATH = 'd:/Keil'
BUILD = 'debug' BUILD = 'debug'
if PLATFORM == 'gcc': if PLATFORM == 'gcc':
@ -33,15 +19,15 @@ if PLATFORM == 'gcc':
AS = PREFIX + 'gcc' AS = PREFIX + 'gcc'
AR = PREFIX + 'ar' AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc' LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf' TARGET_EXT = 'axf'
SIZE = PREFIX + 'size' SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump' OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy' OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=arm920t' DEVICE = ' -mcpu=ARM7TDMI'
CFLAGS = DEVICE + ' -DRT_USING_MINILIBC' CFLAGS = DEVICE + ' -DRT_USING_MINILIBC'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,Reset_Handler -T mini2440_rom.ld' LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-lpc2478.map,-cref,-u,Reset_Handler -T lpc2478_rom.ld'
CPATH = '' CPATH = ''
LPATH = '' LPATH = ''
@ -52,7 +38,6 @@ if PLATFORM == 'gcc':
else: else:
CFLAGS += ' -O2' CFLAGS += ' -O2'
RT_USING_MINILIBC = True
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc': elif PLATFORM == 'armcc':
@ -63,14 +48,13 @@ elif PLATFORM == 'armcc':
LINK = 'armlink' LINK = 'armlink'
TARGET_EXT = 'axf' TARGET_EXT = 'axf'
DEVICE = ' --device DARMP' DEVICE = ' --device DARMSTM'
CFLAGS = DEVICE + ' --apcs=interwork' CFLAGS = DEVICE + ' --apcs=interwork'
AFLAGS = DEVICE AFLAGS = DEVICE
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtt-lpc2478.map --strict --scatter ".\objs\lpc2478.sct"t' LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-lpc2478.map --scatter lpc2478_rom.sct'
CFLAGS += ' -I"' + EXEC_PATH + '/ARM/RV31/INC"' CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
CFLAGS += ' -I"' + EXEC_PATH + '/ARM/INC/Philips"' LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
LFLAGS += ' --libpath "' + EXEC_PATH + '/ARM/RV31/LIB"'
EXEC_PATH += '/arm/bin40/' EXEC_PATH += '/arm/bin40/'
@ -80,18 +64,22 @@ elif PLATFORM == 'armcc':
else: else:
CFLAGS += ' -O2' CFLAGS += ' -O2'
RT_USING_MINILIBC = False
if RT_USING_FINSH:
LFLAGS += ' --keep __fsym_* --keep __vsym_*'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar': elif PLATFORM == 'iar':
# toolchains # toolchains
CC = 'armcc' CC = 'iccarm'
AS = 'armasm' AS = 'iasmarm'
AR = 'armar' AR = 'iarchive'
LINK = 'armlink' LINK = 'ilinkarm'
TARGET_EXT = 'out'
DEVICE = ' --cpu DARMSTM --thumb'
CFLAGS = '' CFLAGS = ''
AFLAGS = '' AFLAGS = ''
LFLAGS = '' LFLAGS = ' --config lpc24xx_flash.icf'
EXEC_PATH += '/arm/bin/'
RT_USING_MINILIBC = False
POST_ACTION = ''

98
bsp/lpc2478/template.Uv2 Normal file
View File

@ -0,0 +1,98 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
Target (RT-Thread LPC2478), 0x0004 // Tools: 'ARM-ADS'
Options 1,0,0 // Target 'RT-Thread LPC2478'
Device (LPC2478)
Vendor (NXP (founded by Philips))
Cpu (IRAM(0x40000000-0x4000FFFF) IRAM2(0x7FE00000-0x7FE03FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE(ARM7TDMI))
FlashUt (LPC210x_ISP.EXE ("#H" ^X $D COM1: 38400 1))
StupF ("STARTUP\Philips\LPC2400.s" ("Philips LPC2400 Startup Code"))
FlashDR (UL2ARM(-U268761108 -O7 -S0 -C0 -FO15 -FD40000000 -FC800 -FN1 -FF0LPC_IAP2_512 -FS00 -FL07E000))
DevID (4307)
Rgf (LPC23xx.H)
Mem ()
C ()
A ()
RL ()
OH ()
DBC_IFX ()
DBC_CMS ()
DBC_AMS ()
DBC_LMS ()
UseEnv=0
EnvBin ()
EnvInc ()
EnvLib ()
EnvReg (Philips\)
OrgReg (Philips\)
TgStat=16
OutDir (.\obj\)
OutName (rtthread-lpc)
GenApp=1
GenLib=0
GenHex=0
Debug=1
Browse=1
LstDir (.\obj\)
HexSel=1
MG32K=0
TGMORE=0
RunUsr 0 0 <>
RunUsr 1 0 <>
BrunUsr 0 0 <>
BrunUsr 1 0 <>
CrunUsr 0 0 <>
CrunUsr 1 0 <>
SVCSID <>
GLFLAGS=1790
ADSFLGA { 243,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LL)()(TARMP.DLL)(-pLPC2478)
OPTDBG 48126,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
FLASH1 { 9,0,0,0,1,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0 }
FLASH2 (BIN\UL2ARM.DLL)
FLASH3 ("LPC210x_ISP.EXE" ("#H" ^X $D COM1: 38400 1))
FLASH4 ()
EndOpt