diff options
| author | dzzxzz <[email protected]> | 2011-02-16 13:36:05 +0000 |
|---|---|---|
| committer | dzzxzz <[email protected]> | 2011-02-16 13:36:05 +0000 |
| commit | e01eaabee9b8ca9c4c4236dc37d5131cf3e8fe2e (patch) | |
| tree | 81a6f04213567c153e20104037aa945bd637e931 /bsp/m16c62p | |
| parent | 29db3e32951945a0cca21f4a188092fca59c5e53 (diff) | |
using SCONS to build IAR M16C project
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1271 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/m16c62p')
| -rw-r--r-- | bsp/m16c62p/SConscript | 13 | ||||
| -rw-r--r-- | bsp/m16c62p/SConstruct | 39 | ||||
| -rw-r--r-- | bsp/m16c62p/rtconfig.py | 123 |
3 files changed, 175 insertions, 0 deletions
diff --git a/bsp/m16c62p/SConscript b/bsp/m16c62p/SConscript new file mode 100644 index 0000000000..7f300243cc --- /dev/null +++ b/bsp/m16c62p/SConscript @@ -0,0 +1,13 @@ +import rtconfig
+Import('RTT_ROOT')
+from building import *
+
+src_c = ['application.c', 'startup.c', 'board.c', 'bsp.c', 'uart.c']
+src_asm = ['cstartup.asm', 'interrupts.asm', 'vectors.asm']
+
+src = File(src_c + src_asm)
+
+CPPPATH = [RTT_ROOT + '/bsp/m16c62p']
+group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/m16c62p/SConstruct b/bsp/m16c62p/SConstruct new file mode 100644 index 0000000000..f4c22f1062 --- /dev/null +++ b/bsp/m16c62p/SConstruct @@ -0,0 +1,39 @@ +import os
+import sys
+import rtconfig
+
+RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
+sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+from building import *
+
+TARGET = 'rtt2m16c.' + rtconfig.TARGET_EXT
+
+env = Environment(tools = ['mingw'],
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
+ CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'],
+ LINKCOM = ['$LINK $SOURCES $LINKFLAGS -f lnkm30627fhp.xcl -l rtt2m16c.map -o rtt2m16c.d34 -Omotorola-s28=$TARGET'])
+env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
+
+if GetDepend('RT_USING_WEBSERVER'):
+ objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
+
+if GetDepend('RT_USING_RTGUI'):
+ objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
+
+# libc testsuite
+# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
+
+# build program
+env.Program(TARGET, objs)
+
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/m16c62p/rtconfig.py b/bsp/m16c62p/rtconfig.py new file mode 100644 index 0000000000..761cc49306 --- /dev/null +++ b/bsp/m16c62p/rtconfig.py @@ -0,0 +1,123 @@ +# toolchains options
+ARCH = 'm16c'
+CPU = 'm16c62p'
+
+CROSS_TOOL = 'iar'
+
+if CROSS_TOOL == 'gcc':
+ PLATFORM = 'gcc'
+ EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
+elif CROSS_TOOL == 'keil':
+ PLATFORM = 'armcc'
+ EXEC_PATH = 'C:/Keil'
+elif CROSS_TOOL == 'iar':
+ PLATFORM = 'iar'
+ IAR_PATH = 'C:/Program Files/IAR Systems/Embedded Workbench Evaluation 6.0'
+# EXEC_PATH = 'C:/Program Files/IAR Systems/Embedded Workbench Evaluation 6.0'
+
+BUILD = 'debug'
+
+if PLATFORM == 'gcc':
+ # toolchains
+ PREFIX = 'arm-none-eabi-'
+ CC = PREFIX + 'gcc'
+ AS = PREFIX + 'gcc'
+ AR = PREFIX + 'ar'
+ LINK = PREFIX + 'gcc'
+ TARGET_EXT = 'axf'
+ SIZE = PREFIX + 'size'
+ OBJDUMP = PREFIX + 'objdump'
+ OBJCPY = PREFIX + 'objcopy'
+
+ DEVICE = ' -mcpu=arm920t'
+ CFLAGS = DEVICE
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + ' -DTEXT_BASE=' + TextBase
+ LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_mini2440.map,-cref,-u,_start -T mini2440_ram.ld' + ' -Ttext ' + TextBase
+
+ CPATH = ''
+ LPATH = ''
+
+ if BUILD == 'debug':
+ CFLAGS += ' -O0 -gdwarf-2'
+ AFLAGS += ' -gdwarf-2'
+ else:
+ CFLAGS += ' -O2'
+
+ 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 DARMSS9'
+ CFLAGS = DEVICE + ' --apcs=interwork --diag_suppress=870'
+ AFLAGS = DEVICE
+ LFLAGS = DEVICE + ' --strict --info sizes --info totals --info unused --info veneers --list rtthread-mini2440.map --ro-base 0x30000000 --entry Entry_Point --first Entry_Point'
+
+ CFLAGS += ' -I"' + EXEC_PATH + '/ARM/RV31/INC"'
+ LFLAGS += ' --libpath "' + EXEC_PATH + '/ARM/RV31/LIB"'
+
+ EXEC_PATH += '/arm/bin40/'
+
+ if BUILD == 'debug':
+ CFLAGS += ' -g -O0'
+ AFLAGS += ' -g'
+ else:
+ CFLAGS += ' -O2'
+
+ POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
+
+elif PLATFORM == 'iar':
+ # toolchains
+ CC = 'iccm16c'
+ AS = 'am16c'
+ AR = 'xar'
+ LINK = 'xlink'
+ TARGET_EXT = 'mot'
+
+ DEVICE = '--cpu M16C'
+
+ EXEC_PATH = IAR_PATH + '/m16c/bin'
+
+ AFLAGS = '-s+'
+# AFLAGS += ' -M<>'
+ AFLAGS += ' -w+'
+ AFLAGS += ' -r'
+ AFLAGS += ' -I"' + IAR_PATH + '/m16c/INC"'
+
+ LFLAGS = '-xms'
+ LFLAGS += ' -I"' + IAR_PATH + '/m16c/LIB"'
+ LFLAGS += ' -rt'
+ LFLAGS += ' -s __program_start'
+ LFLAGS += ' -D_CSTACK_SIZE=80'
+ LFLAGS += ' -D_ISTACK_SIZE=40'
+ LFLAGS += ' -D_DATA16_HEAP_SIZE=1000'
+ LFLAGS += ' -D_FAR_HEAP_SIZE=400'
+ LFLAGS += ' -D_DATA20_HEAP_SIZE=400'
+ LFLAGS += ' "' + IAR_PATH + '/m16c/LIB/CLIB/clm16cfnffwc.r34"'
+ LFLAGS += ' -e_small_write=_formatted_write'
+ LFLAGS += ' -e_medium_read=_formatted_read'
+
+ CFLAGS = DEVICE
+ CFLAGS += ' --data_model=far'
+ CFLAGS += ' --calling_convention=normal'
+ CFLAGS += ' --variable_data=near'
+ CFLAGS += ' --constant_data=far'
+ CFLAGS += ' --code_segment=CODE'
+ CFLAGS += ' --debug'
+ CFLAGS += ' -e'
+ CFLAGS += ' --align_func 1'
+ CFLAGS += ' -I"' + IAR_PATH + '/m16c/INC"'
+ CFLAGS += ' -I"' + IAR_PATH + '/m16c/INC/CLIB"'
+ CFLAGS += ' -Ol'
+ CFLAGS += ' --no_cse'
+ CFLAGS += ' --no_unroll'
+ CFLAGS += ' --no_inline'
+ CFLAGS += ' --no_code_motion'
+ CFLAGS += ' --no_tbaa'
+
+ POST_ACTION = ''
|
