From 633c0e0d23c4b874c71595a4d9d13b8d4acdf417 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 5 Sep 2013 13:00:59 +0800 Subject: Test for new features and new tools Signed-off-by: Peng Fan --- rtems.py | 9 +++++++++ shell-init | 2 +- testcase/3.c | 6 ++++++ testcase/33.c | 4 ++++ testcase/333.c | 4 ++++ testcase/4.c | 8 ++++++++ testcase/wscript | 42 ++++++++++++++++++++++++++++++++++++++++++ wscript | 6 +++++- 8 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 testcase/3.c create mode 100644 testcase/33.c create mode 100644 testcase/333.c create mode 100644 testcase/4.c diff --git a/rtems.py b/rtems.py index 1fb0b2a..84cd193 100644 --- a/rtems.py +++ b/rtems.py @@ -383,6 +383,7 @@ def _find_tools(conf, arch, paths, tools): arch_tools['OBJCOPY'] = conf.find_program([arch + '-objcopy'], path_list = paths) arch_tools['READELF'] = conf.find_program([arch + '-readelf'], path_list = paths) arch_tools['RTEMS_LD'] = conf.find_program(['rtems-ld'], path_list = paths) + arch_tools['RTEMS_RA'] = conf.find_program(['rtems-ra'], path_list = paths) tools[arch] = arch_tools return tools @@ -512,6 +513,7 @@ def _log_header(conf): from waflib import TaskGen from waflib.Tools.ccroot import link_task, USELIB_VARS USELIB_VARS['rap'] = set(['RTEMS_LINKFLAGS']) +USELIB_VARS['ra'] = set(['RTEMS_RAFLAGS']) @TaskGen.extension('.c') class rap(link_task): "Link object files into a RTEMS applicatoin" @@ -519,3 +521,10 @@ class rap(link_task): ext_out = ['.rap'] vars = ['RTEMS_LINKFLAGS', 'LINKDEPS'] inst_to = '${BINDIR}' + +class ra(link_task): + "Link object files into a RTEMS applicatoin" + run_str = '${RTEMS_RA} ${RTEMS_RAFLAGS} --cc ${CC} ${SRC} -o ${TGT[0].abspath()} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB}' + ext_out = ['.ra'] + vars = ['RTEMS_RAFLAGS', 'LINKDEPS'] + inst_to = '${BINDIR}' diff --git a/shell-init b/shell-init index 0859000..ac2f9fa 100644 --- a/shell-init +++ b/shell-init @@ -12,4 +12,4 @@ rtl-trace set load load-sect symbol reloc #unresolved rap ld ./bsdport.rap rap ls -rap ld ./test.rap +#rap ld ./test.rap diff --git a/testcase/3.c b/testcase/3.c new file mode 100644 index 0000000..4e63c1b --- /dev/null +++ b/testcase/3.c @@ -0,0 +1,6 @@ +#include +int ar_func_test(void) +{ + printf ("ar_func_test\n"); + return 0x55; +} diff --git a/testcase/33.c b/testcase/33.c new file mode 100644 index 0000000..dfc08f8 --- /dev/null +++ b/testcase/33.c @@ -0,0 +1,4 @@ +int t1(void) +{ + return 1; +} diff --git a/testcase/333.c b/testcase/333.c new file mode 100644 index 0000000..0c810fc --- /dev/null +++ b/testcase/333.c @@ -0,0 +1,4 @@ +int t2(void) +{ + return 2; +} diff --git a/testcase/4.c b/testcase/4.c new file mode 100644 index 0000000..f038c0b --- /dev/null +++ b/testcase/4.c @@ -0,0 +1,8 @@ +#include +int rtems(int argc, char **argv) +{ + int a; + a =ar_func_test(); + printf("a = 0x%x\n",a); + return 0; +} diff --git a/testcase/wscript b/testcase/wscript index b455b4e..f9603bd 100644 --- a/testcase/wscript +++ b/testcase/wscript @@ -16,6 +16,44 @@ def build(bld): # cflags = '-mthumb -fno-common -DTHUMB_TEST', # cflags = '-marm -mcpu=arm1176jzf-s -fno-common -DARM_TEST', +############ For ar rap ################# + bld(target = '3', + features = 'c cstlib', + includes = bld.includes, + cflags = '-fno-common', + defines = bld.defines, + source = ['3.c', '33.c', '333.c']) + + bld(target = '../lib3.ra', + rule = 'touch ../lib3.ra') + + bld( + features = 'c ra', + xxxx = 'hello', + + cflags = '-fno-common', + + rtems_raflags = ['--lib', '3', + '--lib-path', 'testcase', + '--output-path', './', + '--no-stdlibs'],) + + bld(target = 'my.rap', + features = 'c rap', + xxxx = 'hello', + + cflags = '-fno-common', + + rtems_linkflags = ['--base', 'rtld.prelink', + '--entry', 'rtems', + '--lib-path', 'testcase', + '--lib', '3', '--runtime-lib', 'ttt'], + source = ['4.c']) + + bld(target = '../libttt.ra', + rule = 'touch ../libttt.ra') +##############End######################## + if arch == 'arm': bld(target = 'test.rap', features = 'c rap', @@ -135,3 +173,7 @@ def build(bld): bld(target = '../test.rap', source = ['test.rap'], rule = 'cp ${SRC} ${TGT}') + + bld(target = '../my.rap', + source = ['my.rap'], + rule = 'cp ${SRC} ${TGT}') diff --git a/wscript b/wscript index 246e67e..8e96d3b 100644 --- a/wscript +++ b/wscript @@ -189,6 +189,8 @@ def build(bld): bld.recurse('testcase'); + bld.add_group () + if re.match('pc[3456]86', bsp) is not None: raps = ['bsdport.rap'] else: @@ -196,8 +198,9 @@ def build(bld): bld(target = 'fs-root.tar', name = 'fs', - source = ['shell-init', 'libx.a', 'x.rap', 'test.rap'] + raps, + source = ['shell-init', 'libx.a', 'x.rap', 'test.rap', 'my.rap', 'lib3.ra', 'libttt.ra'] + raps, rule = 'tar --format=ustar -cf ${TGT} ${SRC}') + bld.objects(name = 'rootfs', target = 'fs-root-tarfile.o', source = 'fs-root.tar', @@ -226,6 +229,7 @@ def build(bld): def rebuild(ctx): import waflib.Options + waflib.Options.commands.extend(['clean', 'build']) def tags(ctx): -- cgit v1.2.3