--- a/LPCBeremiz.py Mon Dec 07 22:04:43 2009 +0100
+++ b/LPCBeremiz.py Tue Dec 08 12:54:28 2009 +0100
@@ -354,26 +354,23 @@
class LPCPluginsRoot(PluginsRoot):
- PlugChildsTypes = [("LPCBus", LPCBus, "LPC bus")]
{"bitmap" : opjimg("Build"),
"tooltip" : _("Build project into build folder"),
- {"bitmap" : opjimg("Clean"),
- "tooltip" : _("Clean project build folder"),
+ def __init__(self, frame, logger): + PluginsRoot.__init__(self, frame, logger) + self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus")] def GetProjectName(self):
return self.Project.getname()
def GetDefaultTarget(self):
target = self.Classes["BeremizRoot_TargetType"]()
- target_value = self.Classes["TargetType_Makefile"]()
+ target_value = self.Classes["TargetType_LPC"]() target_value.setBuildPath(self.BuildPath)
target.setcontent({"name": "Makefile", "value": target_value})
@@ -396,11 +393,17 @@
def LoadProject(self, ProjectPath, BuildPath=None):
- Load a project XML file
- @param ProjectPath: path of the project xml file
+ Load a project contained in a folder + @param ProjectPath: path of the project folder + if os.path.basename(ProjectPath) == "": + ProjectPath = os.path.dirname(ProjectPath) + # Verify that project contains a PLCOpen program + plc_file = os.path.join(ProjectPath, "plc.xml") + if not os.path.isfile(plc_file): + return _("Chosen folder doesn't contain a program. It's not a valid project!") - result = self.OpenXMLFile(ProjectPath)
+ result = self.OpenXMLFile(plc_file) # Change XSD into class members
@@ -408,15 +411,21 @@
# Keep track of the root plugin (i.e. project path)
self.ProjectPath = ProjectPath
- self.BuildPath = tempfile.mkdtemp()
+ self.BuildPath = self._getBuildPath() if BuildPath is not None:
mycopytree(BuildPath, self.BuildPath)
+ # If dir have already be made, and file exist + if os.path.isdir(self.PlugPath()) and os.path.isfile(self.PluginXmlFilePath()): + #Load the plugin.xml file into parameters members + result = self.LoadXMLParams() + #Load and init all the childs self.RefreshPluginsBlockLists()
- if os.path.exists(self._getBuildPath()):
- self.EnableMethod("_Clean", True)
self.SaveXMLFile(self.ProjectPath)
@@ -726,7 +735,7 @@
def __init__(self, projectOpen, buildpath):
self.PluginRoot = LPCPluginsRoot(None, self.Log)
- if projectOpen is not None and os.path.isfile(projectOpen):
+ if projectOpen is not None and os.path.isdir(projectOpen): result = self.PluginRoot.LoadProject(projectOpen, buildpath)
print "Error: Invalid project directory", result
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/LPC/XSD Tue Dec 08 12:54:28 2009 +0100
@@ -0,0 +1,6 @@
+ <xsd:element name="Makefile"> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/LPC/__init__.py Tue Dec 08 12:54:28 2009 +0100
@@ -0,0 +1,7 @@
+from .. import toolchain_makefile +class Makefile_target(toolchain_makefile): + def getBuilderLDFLAGS(self): + return toolchain_makefile.getBuilderLDFLAGS(self) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/LPC/plc_LPC_main.c Tue Dec 08 12:54:28 2009 +0100
@@ -0,0 +1,94 @@
+ * Yagarto specific code +/* provided by POUS.C */ +extern int common_ticktime__; +void Target_GetTime(IEC_TIME*); +long AtomicCompareExchange(long* atomicvar,long compared, long exchange) +void PLC_GetTime(IEC_TIME *CURRENT_TIME) + /* Call target GetTime function */ + Target_GetTime(CURRENT_TIME); +void PLC_SetTimer(long long next, long long period) +int startPLC(int argc,char **argv) + if(__init(argc,argv) == 0) +int TryEnterDebugSection(void) +void LeaveDebugSection(void) +extern unsigned long __tick; +/* from plc_debugger.c */ +int WaitDebugData(unsigned long *tick) +/* Called by PLC thread when debug_publish finished + * This is supposed to unlock debugger thread in WaitDebugData*/ +void InitiateDebugTransfer(void) +int WaitPythonCommands(void) +/* Called by PLC thread on each new python command*/ +void UnBlockPythonCommands(void) --- a/targets/Makefile/XSD Mon Dec 07 22:04:43 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
- <xsd:element name="Makefile">
\ No newline at end of file
--- a/targets/Makefile/__init__.py Mon Dec 07 22:04:43 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-from .. import toolchain_makefile
-class Makefile_target(toolchain_makefile):
- def getBuilderLDFLAGS(self):
- return toolchain_makefile.getBuilderLDFLAGS(self)
--- a/targets/Makefile/plc_Makefile_main.c Mon Dec 07 22:04:43 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
- * Yagarto specific code
-/* provided by POUS.C */
-extern int common_ticktime__;
-void Target_GetTime(IEC_TIME*);
-long AtomicCompareExchange(long* atomicvar,long compared, long exchange)
-void PLC_GetTime(IEC_TIME *CURRENT_TIME)
- /* Call target GetTime function */
- Target_GetTime(CURRENT_TIME);
-void PLC_SetTimer(long long next, long long period)
-int startPLC(int argc,char **argv)
- if(__init(argc,argv) == 0)
-int TryEnterDebugSection(void)
-void LeaveDebugSection(void)
-extern unsigned long __tick;
-/* from plc_debugger.c */
-int WaitDebugData(unsigned long *tick)
-/* Called by PLC thread when debug_publish finished
- * This is supposed to unlock debugger thread in WaitDebugData*/
-void InitiateDebugTransfer(void)
-int WaitPythonCommands(void)
-/* Called by PLC thread on each new python command*/
-void UnBlockPythonCommands(void)