--- a/LPCBeremiz.py Sat Dec 12 20:49:07 2009 +0100
+++ b/LPCBeremiz.py Sat Dec 12 20:51:56 2009 +0100
@@ -399,19 +399,16 @@
def GetProjectName(self):
return self.Project.getname()
- def GetDefaultTarget(self):
- target = self.Classes["BeremizRoot_TargetType"]()
+ def GetDefaultTargetName(self):
if self.BuildSimulation:
- if wx.Platform == '__WXMSW__':
- target_name = "Win32"
- else:
- target_name = "Linux"
- target_value = self.Classes["TargetType_%s"%target_name]()
+ return PluginsRoot.GetDefaultTargetName(self)
else:
- target_name = "LPC"
- target_value = self.Classes["TargetType_LPC"]()
- target_value.setBuildPath(self.BuildPath)
- target.setcontent({"name": target_name, "value": target_value})
+ return "LPC"
+
+ def GetTarget(self):
+ target = PluginsRoot.GetTarget(self)
+ if not self.BuildSimulation:
+ target.getcontent()["value"].setBuildPath(self.BuildPath)
return target
def _getBuildPath(self):
@@ -433,6 +430,8 @@
def SetOnlineMode(self, mode, path=None):
if self.OnlineMode != mode:
self.OnlineMode = mode
+ self.KillDebugThread()
+
if self.OnLineMode != 0:
if self._connector is None:
uri = "LPC://%s" % path
--- a/plugger.py Sat Dec 12 20:49:07 2009 +0100
+++ b/plugger.py Sat Dec 12 20:51:56 2009 +0100
@@ -843,12 +843,18 @@
childs.append(child.GetPlugInfos())
return {"name" : "PLC (%s)"%self.GetProjectName(), "type" : None, "values" : childs}
- def GetDefaultTarget(self):
- target = self.Classes["BeremizRoot_TargetType"]()
+ def GetDefaultTargetName(self):
if wx.Platform == '__WXMSW__':
- target.setcontent({"name": "Win32", "value": self.Classes["TargetType_Win32"]()})
+ return "Win32"
else:
- target.setcontent({"name": "Linux", "value": self.Classes["TargetType_Linux"]()})
+ return "Linux"
+
+ def GetTarget(self):
+ target = self.BeremizRoot.getTargetType()
+ if target.getcontent() is None:
+ target = self.Classes["BeremizRoot_TargetType"]()
+ target_name = self.GetDefaultTargetName()
+ target.setcontent({"name": target_name, "value": self.Classes["TargetType_%s"%target_name]()})
return target
def GetParamsAttributes(self, path = None):
@@ -856,7 +862,7 @@
if params[0]["name"] == "BeremizRoot":
for child in params[0]["children"]:
if child["name"] == "TargetType" and child["value"] == '':
- child.update(self.GetDefaultTarget().getElementInfos("TargetType"))
+ child.update(self.GetTarget().getElementInfos("TargetType"))
return params
def SetParamsAttribute(self, path, value):
@@ -1196,10 +1202,7 @@
Return a Builder (compile C code into machine code)
"""
# Get target, module and class name
- target = self.BeremizRoot.getTargetType()
- if target.getcontent() is None:
- target = self.GetDefaultTarget()
- targetname = target.getcontent()["name"]
+ targetname = self.GetTarget().getcontent()["name"]
modulename = "targets." + targetname
classname = targetname + "_target"
@@ -1390,12 +1393,7 @@
"init_calls":"\n",
"cleanup_calls":"\n"
}
-
- target = self.BeremizRoot.getTargetType()
- if target.getcontent() is None:
- target = self.GetDefaultTarget()
- target_name = target.getcontent()["name"]
- plc_main_code += targets.targetcode(target_name)
+ plc_main_code += targets.targetcode(self.GetTarget().getcontent()["name"])
return plc_main_code
@@ -1454,7 +1452,7 @@
open(fpath, "wb").write(fobject.read())
# Now we can forget ExtraFiles (will close files object)
del ExtraFiles
-
+
# Template based part of C code generation
# files are stacked at the beginning, as files of plugin tree root
for generator, filename, name in [
--- a/targets/Xenomai/__init__.py Sat Dec 12 20:49:07 2009 +0100
+++ b/targets/Xenomai/__init__.py Sat Dec 12 20:51:56 2009 +0100
@@ -5,7 +5,7 @@
extension = ".so"
def getXenoConfig(self):
""" Get xeno-config from target parameters """
- return self.getTarget().getcontent()["value"].getXenoConfig()
+ return self.PluginsRootInstance.GetTarget().getcontent()["value"].getXenoConfig()
def getBuilderLDFLAGS(self):
# get xeno-config from target parameters
--- a/targets/toolchain_gcc.py Sat Dec 12 20:49:07 2009 +0100
+++ b/targets/toolchain_gcc.py Sat Dec 12 20:51:56 2009 +0100
@@ -14,25 +14,19 @@
self.PluginsRootInstance = PluginsRootInstance
self.buildpath = None
self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
-
- def getTarget(self):
- target = self.PluginsRootInstance.BeremizRoot.getTargetType()
- if target.getcontent() is None:
- target = self.PluginsRootInstance.GetDefaultTarget()
- return target
-
+
def getBuilderCFLAGS(self):
"""
Returns list of builder specific CFLAGS
"""
- return [self.getTarget().getcontent()["value"].getCFLAGS()]
+ return [self.PluginsRootInstance.GetTarget().getcontent()["value"].getCFLAGS()]
def getBuilderLDFLAGS(self):
"""
Returns list of builder specific LDFLAGS
"""
return self.PluginsRootInstance.LDFLAGS + \
- [self.getTarget().getcontent()["value"].getLDFLAGS()]
+ [self.PluginsRootInstance.GetTarget().getcontent()["value"].getLDFLAGS()]
def GetBinaryCode(self):
try:
@@ -88,7 +82,7 @@
def build(self):
# Retrieve toolchain user parameters
- toolchain_params = self.getTarget().getcontent()["value"]
+ toolchain_params = self.PluginsRootInstance.GetTarget().getcontent()["value"]
self.compiler = toolchain_params.getCompiler()
self.linker = toolchain_params.getLinker()
--- a/targets/toolchain_makefile.py Sat Dec 12 20:49:07 2009 +0100
+++ b/targets/toolchain_makefile.py Sat Dec 12 20:51:56 2009 +0100
@@ -1,7 +1,6 @@
-import os, re, operator
+import os, re
from wxPopen import ProcessLogger
-import hashlib, shutil
-from toolchain_gcc import toolchain_gcc
+import hashlib
includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
@@ -12,12 +11,6 @@
self.buildpath = None
self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
- def getTarget(self):
- target = self.PluginsRootInstance.BeremizRoot.getTargetType()
- if target.getcontent() is None:
- target = self.PluginsRootInstance.GetDefaultTarget()
- return target
-
def SetBuildPath(self, buildpath):
self.buildpath = buildpath
self.exe_path = os.path.join(self.buildpath, "ArmPLC_rom.bin")
@@ -64,7 +57,7 @@
"md5": self.md5key
}
- target = self.getTarget().getcontent()["value"]
+ target = self.PluginsRootInstance.GetTarget().getcontent()["value"]
command = target.getCommand().split(' ') +\
[target.getBuildPath()] +\
[arg % beremizcommand for arg in target.getArguments().split(' ')] +\