move more options to rtconfig.py

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@120 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2009-10-22 09:44:08 +00:00
parent a8065da962
commit 2f55ad6e89
3 changed files with 104 additions and 78 deletions

View File

@ -2,67 +2,20 @@ import os
import rtconfig import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
device_type = 'STM32F10X_HD'
if rtconfig.CC == 'armcc': target = 'rtthread-stm32'
device = '--device DARMSTM'
device_type = 'STM32F10X_HD'
# assemble flag for ARCC(Keil)
aflags = '--dwarf2 ' + device
cc_path = 'C:/Keil'
cc_exec_path = cc_path + '/arm/bin40/'
cc_cpath = cc_path + '/ARM/RV31/INC'
# compiler flag for ARMCC(Keil)
cc_cflags = '-g -O0 --apcs=interwork ' + device + ' -DUSE_STDPERIPH_DRIVER -DSTM32F10X_HD'
cc_lflags = ' --keep __fsym_* --keep __vsym_* --info sizes --info totals --info unused --info veneers --list rtthread-stm32.map --scatter stm32_rom.sct --libpath ' + cc_path + '/ARM/RV31/LIB'
cc_target = 'rtthread-stm32.axf'
elif rtconfig.CC == 'gcc':
device = '-mcpu=cortex-m3'
device_type = 'STM32F10X_HD'
aflags = device + ' -c -gdwarf-2 -mthumb -x assembler-with-cpp'
cc_path = ''
cc_cpath = ''
cc_exec_path = 'd:/codesourcery/bin'
cc_cflags = device + ' -mthumb -gdwarf-2 -DUSE_STDPERIPH_DRIVER -DSTM32F10X_HD -D__thumb__ -Wall -nostdinc -fno-builtin'
cc_lflags = cc_cflags + ' -MMD -MP -MF -static -nostdlib -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,Reset_Handler -T stm32_rom.ld --output rtthread-stm32.elf'
cc_target = 'rtthread-stm32.elf'
elif rtconfig.CC == 'iar':
device = ''
device_type = 'STM32F10X_HD'
aflags = ''
cc_path = ''
cc_cpath = ''
cc_exec_path = ''
cc_cflags = device + ''
cc_lflags = ''
cc_target = 'rtthread-stm32.elf'
aflags = aflags
cflags = cc_cflags
# search path for C compiler # search path for C compiler
cpath = [RTT_ROOT + '/bsp/stm3210'] bsp_path = RTT_ROOT + '/bsp/stm3210'
# link flag env = Environment(tools = ['mingw'],
lflags = device + cc_lflags AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
if rtconfig.CC == 'armcc': AR = rtconfig.AR, ARFLAGS = '-rc',
env = Environment(tools = ['mingw'], LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
AS='armasm', ASFLAGS = aflags, env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
CC='armcc', CCFLAGS = cflags, CPPPATH = cpath, env.AppendUnique(CPPPATH = bsp_path)
AR='armar', ARFLAGS = '-rc', env.AppendUnique(CCFLAGS = ' -DUSE_STDPERIPH_DRIVER -DSTM32F10X_HD')
LINK='armlink', LINKFLAGS=lflags)
env.PrependENVPath('PATH', cc_exec_path)
if rtconfig.CC == 'gcc':
env = Environment(tools = ['mingw'],
AS='arm-none-eabi-gcc', ASFLAGS = aflags,
CC='arm-none-eabi-gcc', CCFLAGS = cflags, CPPPATH = cpath,
AR='arm-none-eabi-ar', ARFLAGS = '-rc',
LINK='arm-none-eabi-gcc', LINKFLAGS=lflags)
env.PrependENVPath('PATH', cc_exec_path)
Export('env') Export('env')
Export('RTT_ROOT') Export('RTT_ROOT')
@ -84,21 +37,23 @@ if rtconfig.RT_USING_DFS:
if rtconfig.RT_USING_LWIP: if rtconfig.RT_USING_LWIP:
objs = objs + SConscript(RTT_ROOT + '/net/lwip/SConscript', variant_dir='build/net/lwip', duplicate=0) objs = objs + SConscript(RTT_ROOT + '/net/lwip/SConscript', variant_dir='build/net/lwip', duplicate=0)
source_bsp = ['application.c', 'startup.c', 'board.c', 'stm32f10x_it.c'] src_bsp = ['application.c', 'startup.c', 'board.c', 'stm32f10x_it.c']
source_drv = ['rtc.c', 'usart.c'] src_drv = ['rtc.c', 'usart.c']
if rtconfig.RT_USING_DFS: if rtconfig.RT_USING_DFS:
if device_type == 'STM32F10X_HD': if device_type == 'STM32F10X_HD':
source_drv = source_drv + ['sdcard.c'] src_drv += ['sdcard.c']
else: else:
source_drv = source_drv + ['msd.c'] src_drv += ['msd.c']
if rtconfig.RT_USING_LWIP: if rtconfig.RT_USING_LWIP:
if device_type == 'STM32F10X_CL': if device_type == 'STM32F10X_CL':
source_drv = source_drv + ['stm32_eth.c'] src_drv += ['stm32_eth.c']
else: else:
source_drv = source_drv + ['enc28j60.c'] src_drv += ['enc28j60.c']
objs = objs + env.Object(source_bsp + source_drv) objs = objs + env.Object(src_bsp + src_drv)
env.Program(cc_target, objs) TARGET = target + '.' + rtconfig.TARGET_EXT
env.Program(TARGET, objs)
env.AddPostAction(TARGET, rtconfig.POST_ACTION)

View File

@ -1,12 +1,83 @@
# component options
RT_USING_FINSH = True
RT_USING_DFS = True
RT_USING_DFS_YAFFS2 = False
RT_USING_DFS_EFSL = True
RT_USING_LWIP = True
# toolchains options
ARCH='arm' ARCH='arm'
CPU='stm32' CPU='stm32'
CC='armcc' PLATFORM = 'gcc'
TextBase='0x08000000' EXEC_PATH = 'd:/SourceryGCC/bin'
#PLATFORM = 'armcc'
#EXEC_PATH = 'C:/Keil'
BUILD = 'debug'
# component configuration if PLATFORM == 'gcc':
RT_USING_FINSH = True # toolchains
RT_USING_DFS = False PREFIX = 'arm-none-eabi-'
RT_USING_DFS_YAFFS2 = False CC = PREFIX + 'gcc'
RT_USING_DFS_EFSL = False AS = PREFIX + 'gcc'
RT_USING_LWIP = False AR = PREFIX + 'ar'
RT_USING_MINILIBC = False LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb'
CFLAGS = DEVICE + ' -DRT_USING_MINILIBC'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=main.elf.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -gdwarf-2'
AFLAGS += ' -gdwarf-2'
else:
CFLAGS += ' -O2'
RT_USING_MINILIBC = True
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
TARGET_EXT = 'axf'
DEVICE = ' --device DARMSTM'
CFLAGS = DEVICE + ' --apcs=interwork'
AFLAGS = DEVICE
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-stm32.map --scatter stm32_rom.sct'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
EXEC_PATH += '/arm/bin40/'
if BUILD == 'debug':
CFLAGS += ' --dwarf2'
else:
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'
elif PLATFORM == 'iar':
# toolchains
CC = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
CFLAGS = ''
AFLAGS = ''
LFLAGS = ''

View File

@ -6,13 +6,13 @@ comm = rtconfig.ARCH + '/common'
path = rtconfig.ARCH + '/' + rtconfig.CPU path = rtconfig.ARCH + '/' + rtconfig.CPU
# The set of source files associated with this SConscript file. # The set of source files associated with this SConscript file.
if rtconfig.CC == 'armcc': if rtconfig.PLATFORM == 'armcc':
src_local = Glob(path + '/*.c') + Glob(path + '/*_rvds.s') + Glob(comm + '/*.c') src_local = Glob(path + '/*.c') + Glob(path + '/*_rvds.s') + Glob(comm + '/*.c')
if rtconfig.CC == 'gcc': if rtconfig.PLATFORM == 'gcc':
src_local = Glob(path + '/*.c') + Glob(path + '/*_gcc.s') + Glob(comm + '/*.c') src_local = Glob(path + '/*.c') + Glob(path + '/*_gcc.s') + Glob(comm + '/*.c')
if rtconfig.CC == 'iar': if rtconfig.PLATFORM == 'iar':
src_local = Glob(path + '/*.c') + Glob(path + '/*_iar.s') + Glob(comm + '/*.c') src_local = Glob(path + '/*.c') + Glob(path + '/*_iar.s') + Glob(comm + '/*.c')
env.Append(CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU]) env.Append(CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU])