Improved CanFEstival support for LPC - now build and link plugin generated files
authoredouard
Mon, 14 Dec 2009 21:05:10 +0100
changeset 512 36aeab46f27d
parent 511 518c30f2a507
child 515 022e034bd4b8
Improved CanFEstival support for LPC - now build and link plugin generated files
LPCBeremiz.py
plugins/canfestival/canfestival.py
plugins/canfestival/cf_runtime.c
--- a/LPCBeremiz.py	Mon Dec 14 11:03:59 2009 +0100
+++ b/LPCBeremiz.py	Mon Dec 14 21:05:10 2009 +0100
@@ -70,6 +70,18 @@
 from PLCOpenEditor import IDEFrame, ProjectDialog
 
 #-------------------------------------------------------------------------------
+#                          CANFESTIVAL PLUGIN HACK
+#-------------------------------------------------------------------------------
+from plugins.canfestival import canfestival
+class LPC_canfestival_config:
+    def getCFLAGS(self, *args):
+        return ""
+
+    def getLDFLAGS(self, *args):
+        return ""
+        
+canfestival.local_canfestival_config = LPC_canfestival_config() 
+#-------------------------------------------------------------------------------
 #                              LPCModule Class
 #-------------------------------------------------------------------------------
 
--- a/plugins/canfestival/canfestival.py	Mon Dec 14 11:03:59 2009 +0100
+++ b/plugins/canfestival/canfestival.py	Mon Dec 14 21:05:10 2009 +0100
@@ -8,7 +8,7 @@
 import config_utils, gen_cfile, eds_utils
 from networkedit import networkedit
 from objdictedit import objdictedit
-import canfestival_config
+import canfestival_config as local_canfestival_config
 from plugger import PlugTemplate
 from commondialogs import CreateNodeDialog
 import wx
@@ -171,7 +171,7 @@
         res = eds_utils.GenerateEDSFile(os.path.join(buildpath, "Slave_%s.eds"%prefix), slave)
         if res :
             raise Exception, res
-        return [(Gen_OD_path,canfestival_config.getCFLAGS(CanFestivalPath))],"",False
+        return [(Gen_OD_path,local_canfestival_config.getCFLAGS(CanFestivalPath))],"",False
 
 #--------------------------------------------------
 #                    MASTER
@@ -293,7 +293,7 @@
         dump(master, file)
         file.close()
         
-        return [(Gen_OD_path,canfestival_config.getCFLAGS(CanFestivalPath))],"",False
+        return [(Gen_OD_path,local_canfestival_config.getCFLAGS(CanFestivalPath))],"",False
     
 class RootClass:
     XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
@@ -315,7 +315,7 @@
             if element["name"] == "CanFestivalInstance":
                 for child in element["children"]:
                     if child["name"] == "CAN_Driver":
-                        DLL_LIST= getattr(canfestival_config,"DLL_LIST",None)
+                        DLL_LIST= getattr(local_canfestival_config,"DLL_LIST",None)
                         if DLL_LIST is not None:
                             child["type"] = DLL_LIST
                         return infos    
@@ -427,6 +427,6 @@
         f.write(cf_main)
         f.close()
         
-        return [(cf_main_path, canfestival_config.getCFLAGS(CanFestivalPath))],canfestival_config.getLDFLAGS(CanFestivalPath), True
-
-
+        return [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
+
+
--- a/plugins/canfestival/cf_runtime.c	Mon Dec 14 11:03:59 2009 +0100
+++ b/plugins/canfestival/cf_runtime.c	Mon Dec 14 21:05:10 2009 +0100
@@ -79,7 +79,7 @@
       canClose(&nodename##_Data);\
     }
 
-void __cleanup_%(locstr)s()
+void __cleanup_%(locstr)s(void)
 {
     // Stop timer thread
     if(init_level-- > 0){
@@ -91,6 +91,11 @@
     TimerCleanup();
 }
 
+#ifndef stderr
+#define fprintf(...)
+#define fflush(...)
+#endif
+
 #define NODE_OPEN(nodename)\
     if(!canOpen(&nodename##Board,&nodename##_Data)){\
         fprintf(stderr,"Cannot open CAN intefrace %%s at speed %%s\n for CANopen node \"" #nodename "\"",nodename##Board.busname, nodename##Board.baudrate);\
@@ -105,8 +110,8 @@
 #ifndef NOT_USE_DYNAMIC_LOADING
     if( !LoadCanDriver("%(candriver)s") ){
         fprintf(stderr, "Cannot load CAN interface library for CanFestival (%(candriver)s)\n");\
-        fflush(stderr);
-        return -1;
+        fflush(stderr);\
+        return -1;\
     }
 #endif
 
@@ -123,7 +128,7 @@
 #define NODE_SEND_SYNC(nodename)\
     sendSYNCMessage(&nodename##_Data);
 
-void __retrieve_%(locstr)s()
+void __retrieve_%(locstr)s(void)
 {
     /* Locks the stack, so that no changes occurs while PLC access variables
      * TODO : implement buffers to avoid such a big lock
@@ -136,7 +141,7 @@
 #define NODE_PROCEED_SYNC(nodename)\
     proceedSYNC(&nodename##_Data);
 
-void __publish_%(locstr)s()
+void __publish_%(locstr)s(void)
 {
     /* Process sync event */
     %(nodes_proceed_sync)s