targets/Xenomai/__init__.py
author laurent
Thu, 15 Oct 2009 10:11:07 +0200
changeset 417 a895ae50b737
parent 411 8261c8f1e365
child 421 c9ec111ad275
permissions -rwxr-xr-x
Adding support for declaring PluginRoot outside of Beremiz
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 """
411
8261c8f1e365 Bug on Debug trying to start (and stop) before PLC started fixed.
laurent
parents: 361
diff changeset
     8
        return self.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
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    14
        status, result, err_result = ProcessLogger(self.logger, xeno_config + " --xeno-ldflags", no_stdout=True).spin()
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    15
        if status:
361
331d698e1118 Adding support for internationalization
laurent
parents: 329
diff changeset
    16
            self.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
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    25
        status, result, err_result = ProcessLogger(self.logger, xeno_config + " --xeno-cflags", no_stdout=True).spin()
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    26
        if status:
361
331d698e1118 Adding support for internationalization
laurent
parents: 329
diff changeset
    27
            self.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