targets/Xenomai/__init__.py
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 14 Aug 2017 23:27:15 +0300
changeset 1736 7e61baa047f0
parent 1735 c02818d7e29f
child 1742 92932cd370a4
permissions -rwxr-xr-x
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
1511
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     1
#!/usr/bin/env python
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     2
# -*- coding: utf-8 -*-
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     3
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     4
# This file is part of Beremiz, a Integrated Development Environment for
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     5
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     6
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     7
# Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     8
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
     9
# See COPYING file for copyrights details.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    10
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    11
# This program is free software; you can redistribute it and/or
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    12
# modify it under the terms of the GNU General Public License
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    13
# as published by the Free Software Foundation; either version 2
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    14
# of the License, or (at your option) any later version.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    15
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    16
# This program is distributed in the hope that it will be useful,
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    19
# GNU General Public License for more details.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    20
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    21
# You should have received a copy of the GNU General Public License
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    22
# along with this program; if not, write to the Free Software
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    23
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1323
diff changeset
    24
642
cd7ccbbbf471 various cleanups in /targets
Edouard Tisserant
parents: 635
diff changeset
    25
from ..toolchain_gcc import toolchain_gcc
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    26
1736
7e61baa047f0 clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1735
diff changeset
    27
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    28
class Xenomai_target(toolchain_gcc):
1279
0eb9f8af479f Added 'dlopen_prefix' class attributes to targets, in order to handle dlopen of shared object passed to runtime as extra file, and then in PWD (was working with windows only)
Edouard Tisserant
parents: 726
diff changeset
    29
    dlopen_prefix = "./"
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    30
    extension = ".so"
633
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    31
    def getXenoConfig(self, flagsname):
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    32
        """ Get xeno-config from target parameters """
1323
a2b1af39385c Fixed Xenomai target according to new xmlclass
Laurent Bessard
parents: 1279
diff changeset
    33
        xeno_config=self.CTRInstance.GetTarget().getcontent().getXenoConfig()
633
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    34
        if xeno_config:
726
ae63ccc29444 refactoring
Edouard Tisserant
parents: 725
diff changeset
    35
            from util.ProcessLogger import ProcessLogger
725
31dade089db5 refactoring
Edouard Tisserant
parents: 722
diff changeset
    36
            status, result, err_result = ProcessLogger(self.CTRInstance.logger,
633
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    37
                                                       xeno_config + " --skin=native --"+flagsname,
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    38
                                                       no_stdout=True).spin()
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    39
            if status:
1734
750eeb7230a1 clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1511
diff changeset
    40
                self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n") % flagsname)
633
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    41
            return [result.strip()]
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    42
        return []
1735
c02818d7e29f clean-up: fix PEP8 W293 blank line contains whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1734
diff changeset
    43
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    44
    def getBuilderLDFLAGS(self):
633
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    45
        xeno_ldflags = self.getXenoConfig("ldflags")
634
5b925a1d8fed fixed redondant ldflag and a typo in xenomai build
Edouard Tisserant
parents: 633
diff changeset
    46
        return toolchain_gcc.getBuilderLDFLAGS(self) + xeno_ldflags + ["-shared"]
321
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    47
5a4e6278a18b Adding support for Xenomai targets.
lbessard
parents: 203
diff changeset
    48
    def getBuilderCFLAGS(self):
633
70c84e6ff92c Xenomai build now ignores xeno-config if not set
Edouard Tisserant
parents: 615
diff changeset
    49
        xeno_cflags = self.getXenoConfig("cflags")
635
fcdb60cacb2c added -fPIC to satisfy X86_64 build
Edouard Tisserant
parents: 634
diff changeset
    50
        return toolchain_gcc.getBuilderCFLAGS(self) + xeno_cflags + ["-fPIC"]