On 25/10/2019 03:41, Chris Johns wrote:
On 25/10/19 12:12 am, Sebastian Huber wrote:
Hello,

I have a problem in the new build system, which I am not able to solve with my
novice waf knowledge.

You can check out the prototype with these steps:

git clone git://git.rtems.org/sebh/rtems.git
cd rtems
git checkout --track origin/build
./waf bsp_defaults --rtems-bsps=sparc > bsps.ini
./waf configure

I uses ...

  ./waf configure --rtems-tools=/opt/work/rtems/5

:)

./waf

Nice, it took 6.944s to build.

To build a test executable, we need:

1. the test program objects,

2. the libraries, e.g. librtemscpu.a and librtemsbsp.a

3. the linker command file (source or configuration file, see ConfigFileItem in
wscript)

4. the start file start.o

The dependencies on 1. and 2. work. The 3. is basically read-only for a build.
The problem is 4.

The start file is build with:

class StartItem(Item):
     def __init__(self, uid, data):
         super(StartItem, self).__init__(uid, data)

     def build(self, bld):
         bld(
             rule="${CC} -DASM ${CFLAGS} ${CPPFLAGS} ${DEFINES_ST:DEFINES}
${CPPPATH_ST:INCPATHS} -c -o ${TGT} ${SRC}",
             source=self.data["source"],
             target=self.data["target"],
             name=self.uid,
             features="asm",
             includes=bld.env.INCLUDES,
             before=["cstlib"],
         )

Why the need for the rule?

https://lists.rtems.org/pipermail/devel/2019-October/055771.html

Actually, I don't understand this stuff good enough. It would be nice I we could use the standard asm rule:

https://gitlab.com/ita1024/waf/blob/master/waflib/Tools/asm.py#L59

However, when I remove the rule, then start.o is not built.


The test executables are built with:

class ExecutableItem(Item):
     def __init__(self, uid, data):
         super(ExecutableItem, self).__init__(uid, data)
         executables.append(self)

     def build(self, bld):
         if self.is_enabled(bld):
             includes = bld.env["INCLUDES"]
             bld.env["INCLUDES"] = (
                 includes + bld.bsp_includes + ["testsuites/support/include"]
             )
             bld.use = ["rtemstest", "rtemscpu", "rtemsbsp"]
             for p in self.links():
                 p.build(bld)
             bld.env["INCLUDES"] = includes
             bld(
                 target=self.data["target"] + ".exe",
                 use=bld.use,
                 features="c cprogram",
             )
             del bld.use

del ? If there is an active reference it will not be deleted. Python likes to 
share.

This will change. I will probably move to a parameter passed to build().


How can I add a dependency on start.o to the test executables? I tried several
variants of bld.add_manual_dependency(), but nothing worked.

I am not sure, I would need to have a close look at how the test stuff is being
put together. I cannot see where start.o in the bld statement.

Is start.o treated in a special way, maybe hidden when linking in the linker
command?

The start.o is a start file and not a normal object. It is added either through the GCC specs or the linker command file STARTUP() directive.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to