Windows related enhancements
authoretisserant
Sun, 09 Dec 2007 18:58:39 +0100
changeset 75 9ad18a387a96
parent 74 8a726a62fbfc
child 76 2ee45a612c6f
Windows related enhancements
plugger.py
plugins/canfestival/cf_runtime.c
runtime/plc_Win32_main.c
--- a/plugger.py	Sun Dec 09 17:15:56 2007 +0100
+++ b/plugger.py	Sun Dec 09 18:58:39 2007 +0100
@@ -513,7 +513,12 @@
 ####################################################################################
 ####################################################################################
 
-iec2c_path = os.path.join(base_folder, "matiec", "iec2c")
+if wx.Platform != '__WXMSW__':
+    exe_ext=".exe"
+else:
+    exe_ext=""
+
+iec2c_path = os.path.join(base_folder, "matiec", "iec2c"+exe_ext)
 ieclib_path = os.path.join(base_folder, "matiec", "lib")
 
 # import for project creation timestamping
@@ -580,6 +585,9 @@
             </xsd:complexType>
           </xsd:element>
           <xsd:attribute name="Compiler" type="xsd:string" use="required" default="gcc"/>
+          <xsd:attribute name="CFLAGS" type="xsd:string" use="required" default=""/>
+          <xsd:attribute name="Linker" type="xsd:string" use="required" default="ld"/>
+          <xsd:attribute name="LDFLAGS" type="xsd:string" use="required" default=""/>
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>
@@ -873,6 +881,9 @@
         
         # Compile the resulting code into object files.
         compiler = self.BeremizRoot.getCompiler()
+        _CFLAGS = self.BeremizRoot.getCFLAGS()
+        linker = self.BeremizRoot.getLinker()
+        _LDFLAGS = self.BeremizRoot.getLDFLAGS()
         obns = []
         objs = []
         for Location, CFilesAndCFLAGS, DoCalls in LocationCFilesAndCFLAGS:
@@ -887,7 +898,7 @@
                 obns.append(obn)
                 logger.write("   [CC]  "+bn+" -> "+obn+"\n")
                 objectfilename = os.path.splitext(CFile)[0]+".o"
-                status, result, err_result = logger.LogCommand("%s -c %s -o %s %s"%(compiler, CFile, objectfilename, CFLAGS))
+                status, result, err_result = logger.LogCommand("%s -c %s -o %s %s %s"%(compiler, CFile, objectfilename, _CFLAGS, CFLAGS))
                 if status != 0:
                     logger.write_error("Build failed\n")
                     return False
@@ -899,7 +910,7 @@
             exe += ".exe"
         exe_path = os.path.join(buildpath, exe)
         logger.write("   [CC]  " + ' '.join(obns)+" -> " + exe + "\n")
-        status, result, err_result = logger.LogCommand("%s %s -o %s %s"%(compiler, " ".join(objs), exe_path, ' '.join(LDFLAGS)))
+        status, result, err_result = logger.LogCommand("%s %s -o %s %s"%(linker, " ".join(objs), exe_path, ' '.join(LDFLAGS+[_LDFLAGS])))
         if status != 0:
             logger.write_error("Build failed\n")
             return False
--- a/plugins/canfestival/cf_runtime.c	Sun Dec 09 17:15:56 2007 +0100
+++ b/plugins/canfestival/cf_runtime.c	Sun Dec 09 18:58:39 2007 +0100
@@ -77,7 +77,7 @@
 int __init_%(locstr)s(int argc,char **argv)
 {
 #ifndef NOT_USE_DYNAMIC_LOADING
-    if( !LoadCanDriver("libcanfestival_can_%(candriver)s.so") ){
+    if( !LoadCanDriver("%(candriver)s") ){
         fprintf(stderr, "Cannot load CAN interface library for CanFestival (%(candriver)s)\n");\
         return -1;
     }
--- a/runtime/plc_Win32_main.c	Sun Dec 09 17:15:56 2007 +0100
+++ b/runtime/plc_Win32_main.c	Sun Dec 09 18:58:39 2007 +0100
@@ -6,10 +6,11 @@
 void timer_notify()
 {
    struct _timeb timebuffer;
+   printf(".");
 
    _ftime( &timebuffer );
-   CURRENT_TIME.tv_sec = timebuffer.time;
-   CURRENT_TIME.tv_nsec = timebuffer.millitm * 1000000
+   __CURRENT_TIME.tv_sec = timebuffer.time;
+   __CURRENT_TIME.tv_nsec = timebuffer.millitm * 1000000;
    __run();
 }
 
@@ -18,10 +19,10 @@
     HANDLE hTimer = NULL;
     LARGE_INTEGER liDueTime;
 
-    liDueTime.QuadPart = -10000 * maxval(common_ticktime__,1);;
+    liDueTime.QuadPart = -10000 * maxval(common_ticktime__,1);
 
     // Create a waitable timer.
-    hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
+    hTimer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer");
     if (NULL == hTimer)
     {
         printf("CreateWaitableTimer failed (%d)\n", GetLastError());
@@ -30,6 +31,7 @@
 
     if( __init(argc,argv) == 0 ){
 
+    	printf("Tick Time : %d ms\n", common_ticktime__);
         // Set a timer
         if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0))
         {