diff --git a/yaplcconnectors/YAPLC/YAPLCObject.py b/yaplcconnectors/YAPLC/YAPLCObject.py index 5cb9eff..9a625db 100644 --- a/yaplcconnectors/YAPLC/YAPLCObject.py +++ b/yaplcconnectors/YAPLC/YAPLCObject.py @@ -272,6 +272,8 @@ def __init__(self): lib_ext = ".so" TstLib = os.path.dirname(os.path.realpath(__file__)) + "/../../../YaPySerial/bin/libYaPySerial" + lib_ext + if (os.name == 'posix' and not os.path.isfile(TstLib)): + TstLib = "libYaPySerial" + lib_ext TstRoot = TestRoot() print "Construct PLC..." diff --git a/yaplcconnectors/YAPLC/YaPySerial.py b/yaplcconnectors/YAPLC/YaPySerial.py index 5ab472e..8a0c24e 100644 --- a/yaplcconnectors/YAPLC/YaPySerial.py +++ b/yaplcconnectors/YAPLC/YaPySerial.py @@ -147,6 +147,8 @@ def __del__(self): lib_ext = ".so" TestLib = os.path.dirname(os.path.realpath(__file__)) + "/../../../YaPySerial/bin/libYaPySerial" + lib_ext + if (os.name == 'posix' and not os.path.isfile(TestLib)): + TestLib = "libYaPySerial" + lib_ext TestSerial = YaPySerial( TestLib ) TestSerial.Open( "COM256", 9600, "8N1", 2 ) diff --git a/yaplcconnectors/YAPLC/__init__.py b/yaplcconnectors/YAPLC/__init__.py index 380e0af..a2184d9 100644 --- a/yaplcconnectors/YAPLC/__init__.py +++ b/yaplcconnectors/YAPLC/__init__.py @@ -40,5 +40,7 @@ def YAPLC_connector_factory(uri, confnodesroot): lib_ext = ".so" YaPySerialLib = os.path.dirname(os.path.realpath(__file__)) + "/../../../YaPySerial/bin/libYaPySerial" + lib_ext + if (os.name == 'posix' and not os.path.isfile(YaPySerialLib)): + YaPySerialLib = "libYaPySerial" + lib_ext return YAPLCObject(YaPySerialLib,confnodesroot,comportstr) diff --git a/yaplctargets/nuc242/__init__.py b/yaplctargets/nuc242/__init__.py index 519eb04..579e054 100644 --- a/yaplctargets/nuc242/__init__.py +++ b/yaplctargets/nuc242/__init__.py @@ -4,6 +4,8 @@ target_dir = os.path.dirname(os.path.realpath(__file__)) base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..") plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src") +if (os.name == 'posix' and not os.path.isfile(plc_rt_dir)): + plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE/src" class nuc242_target(toolchain_yaplc_stm32): def __init__(self, CTRInstance): diff --git a/yaplctargets/nuc243/__init__.py b/yaplctargets/nuc243/__init__.py index 1b774e6..5df55e6 100644 --- a/yaplctargets/nuc243/__init__.py +++ b/yaplctargets/nuc243/__init__.py @@ -4,6 +4,8 @@ target_dir = os.path.dirname(os.path.realpath(__file__)) base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..") plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src") +if (os.name == 'posix' and not os.path.isfile(plc_rt_dir)): + plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE/src" class nuc243_target(toolchain_yaplc_stm32): def __init__(self, CTRInstance): diff --git a/yaplctargets/nuc247/__init__.py b/yaplctargets/nuc247/__init__.py index 4aaf5dc..83517d2 100644 --- a/yaplctargets/nuc247/__init__.py +++ b/yaplctargets/nuc247/__init__.py @@ -4,6 +4,8 @@ target_dir = os.path.dirname(os.path.realpath(__file__)) base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..") plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src") +if (os.name == 'posix' and not os.path.isfile(plc_rt_dir)): + plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE/src" class nuc247_target(toolchain_yaplc_stm32): def __init__(self, CTRInstance): diff --git a/yaplctargets/nuc251/__init__.py b/yaplctargets/nuc251/__init__.py index 5903b3c..c5aa314 100644 --- a/yaplctargets/nuc251/__init__.py +++ b/yaplctargets/nuc251/__init__.py @@ -4,6 +4,8 @@ target_dir = os.path.dirname(os.path.realpath(__file__)) base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..") plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src") +if (os.name == 'posix' and not os.path.isfile(plc_rt_dir)): + plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE/src" class nuc251_target(toolchain_yaplc_stm32): def __init__(self, CTRInstance): diff --git a/yaplctargets/toolchain_yaplc.py b/yaplctargets/toolchain_yaplc.py index 62a1579..581dff1 100644 --- a/yaplctargets/toolchain_yaplc.py +++ b/yaplctargets/toolchain_yaplc.py @@ -5,6 +5,8 @@ toolchain_dir = os.path.dirname(os.path.realpath(__file__)) base_dir = os.path.join(os.path.join(toolchain_dir, ".."), "..") runtime_dir = os.path.join(os.path.join(base_dir, "RTE"), "src") +if (os.name == 'posix' and not os.path.isfile(runtime_dir)): + runtime_dir = os.environ["HOME"]+"/YAPLC/RTE/src" class toolchain_yaplc(toolchain_gcc): def __init__(self, CTRInstance): diff --git a/yaplctargets/toolchain_yaplc_stm32.py b/yaplctargets/toolchain_yaplc_stm32.py index 94caf46..9996f4e 100644 --- a/yaplctargets/toolchain_yaplc_stm32.py +++ b/yaplctargets/toolchain_yaplc_stm32.py @@ -9,6 +9,8 @@ class toolchain_yaplc_stm32(toolchain_yaplc): def GetBinaryCode(self): if os.path.exists(self.exe_path): yaplc_boot_loader = os.path.join(os.path.join(base_dir, "stm32flash"), "stm32flash") + if (os.name == 'posix' and not os.path.isfile(yaplc_boot_loader)): + yaplc_boot_loader = "stm32flash" command = [yaplc_boot_loader, "-w", self.exe_path + ".hex", "-v", "-g", "0x0", "-S", self.load_addr, "%(serial_port)s"] return command else: diff --git a/yaplctargets/yaplc/__init__.py b/yaplctargets/yaplc/__init__.py index 77565b8..444e954 100644 --- a/yaplctargets/yaplc/__init__.py +++ b/yaplctargets/yaplc/__init__.py @@ -4,6 +4,8 @@ target_dir = os.path.dirname(os.path.realpath(__file__)) base_dir = os.path.join(os.path.join(os.path.join(target_dir, ".."), ".."), "..") plc_rt_dir = os.path.join(os.path.join(base_dir, "RTE"), "src") +if (os.name == 'posix' and not os.path.isfile(plc_rt_dir)): + plc_rt_dir = os.environ["HOME"]+"/YAPLC/RTE/src" class yaplc_target(toolchain_yaplc_stm32): def __init__(self, CTRInstance):