targets/Xenomai/__init__.py
author Lolitech
Fri, 04 Jun 2010 14:58:24 +0200
changeset 555 7b08cc1ea55a
parent 510 8038c08b9874
child 615 72bc3e53a1fa
permissions -rwxr-xr-x
Disabled logging commands into files
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     1
from .. import toolchain_gcc
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     2
from wxPopen import ProcessLogger
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     3
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     4
class Xenomai_target(toolchain_gcc):
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     5
    extension = ".so"
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     6
    def getXenoConfig(self):
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     7
        """ Get xeno-config from target parameters """
510
8038c08b9874 Getting default target when no target defined fixed
laurent
parents: 421
diff changeset
     8
        return self.PluginsRootInstance.GetTarget().getcontent()["value"].getXenoConfig()
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
     9
    
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    10
    def getBuilderLDFLAGS(self):
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    11
        # get xeno-config from target parameters
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    12
        xeno_config = self.getXenoConfig()
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    13
421
c9ec111ad275 Bugs with logger and stand-alone PluginRoot fixed
laurent
parents: 411
diff changeset
    14
        status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger, xeno_config + " --xeno-ldflags", no_stdout=True).spin()
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    15
        if status:
421
c9ec111ad275 Bugs with logger and stand-alone PluginRoot fixed
laurent
parents: 411
diff changeset
    16
            self.PluginsRootInstance.logger.write_error(_("Unable to get Xenomai's LDFLAGS\n"))
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    17
        xeno_ldlags = result.strip()
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    18
        
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    19
        return toolchain_gcc.getBuilderLDFLAGS(self) + [xeno_ldlags, "-shared", "-lnative"]
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    20
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    21
    def getBuilderCFLAGS(self):
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    22
        # get xeno-config from target parameters
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    23
        xeno_config = self.getXenoConfig()
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    24
421
c9ec111ad275 Bugs with logger and stand-alone PluginRoot fixed
laurent
parents: 411
diff changeset
    25
        status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger, xeno_config + " --xeno-cflags", no_stdout=True).spin()
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    26
        if status:
421
c9ec111ad275 Bugs with logger and stand-alone PluginRoot fixed
laurent
parents: 411
diff changeset
    27
            self.PluginsRootInstance.logger.write_error(_("Unable to get Xenomai's CFLAGS\n"))
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    28
        xeno_cflags = result.strip()
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    29
        
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    30
        return toolchain_gcc.getBuilderCFLAGS(self) + [xeno_cflags]
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    31