Commit 392d5f4e authored by yoogx's avatar yoogx

* Various fixes for WIN32 target

parent a01334ed
......@@ -44,25 +44,30 @@ AC_C_BIGENDIAN
# Set CFLAGS and LDFLAGS for the native platform #
##################################################
NATIVE_CFLAGS="-DPOSIX"
NATIVE_CFLAGS=""
NATIVE_LDFLAGS=""
SIMULINK_LDFLAGS=""
case ${host_os} in
*darwin*)
NATIVE_CFLAGS="${NATIVE_CFLAGS} -DNEED_CLOCK_GETTIME"
NATIVE_CFLAGS="${NATIVE_CFLAGS} -DPOSIX -DNEED_CLOCK_GETTIME"
NATIVE_LDFLAGS="${NATIVE_LDFLAGS} -lpthread"
;;
*solaris*10*)
NATIVE_LDFLAGS="${NATIVE_LDFLAGS} -lrt"
;;
*freebsd*)
NATIVE_CFLAGS="${NATIVE_CFLAGS} -D_GNU_SOURCE"
NATIVE_CFLAGS="${NATIVE_CFLAGS} -DPOSIX -D_GNU_SOURCE"
NATIVE_LDFLAGS="${NATIVE_LDFLAGS} -lpthread -lrt"
SIMULINK_LDFLAGS="-lm"
;;
*cygwin*)
NATIVE_CFLAGS="${NATIVE_CFLAGS} -D_GNU_SOURCE"
NATIVE_LDFLAGS="${NATIVE_LDFLAGS} -lpthread -lwsock32"
SIMULINK_LDFLAGS="-lm"
;;
*)
NATIVE_CFLAGS="${NATIVE_CFLAGS} -D_POSIX_SOURCE -D_GNU_SOURCE"
NATIVE_CFLAGS="${NATIVE_CFLAGS} -DPOSIX -D_POSIX_SOURCE -D_GNU_SOURCE"
NATIVE_LDFLAGS="${NATIVE_LDFLAGS} -lpthread -lrt"
SIMULINK_LDFLAGS="-lm"
;;
......
......@@ -42,7 +42,7 @@ scenarios:
scenario:
$(MAKE) clean
@echo "********* SCENARIO_FILE = $(SCENARIO_FILE) *********";
ocarina -b -x '${shell $(CYGPATH_W) $(SCENARIO_FILE)}';
ocarina$(EXEEXT) -b -x '${shell $(CYGPATH_W) $(SCENARIO_FILE)}';
############################################################################
# Code generation and execution from AADL
......@@ -56,7 +56,7 @@ scenarios-check:
scenario-check:
@echo "********* SCENARIO_FILE = $(SCENARIO_FILE) *********";
ocarina -b -e -x '${shell $(CYGPATH_W) $(SCENARIO_FILE)}';
ocarina$(EXEEXT) -b -e -x '${shell $(CYGPATH_W) $(SCENARIO_FILE)}';
############################################################################
......
......@@ -5,16 +5,25 @@ int produce_data = 0;
void user_produce_spg (int* data)
{
#if defined (POSIX)
struct timespec mytime;
clock_gettime (CLOCK_REALTIME, &mytime);
*data = produce_data;
printf ("At time %3lu:%3lu, produce : %d\n", mytime.tv_sec % 3600, mytime.tv_nsec/1000000,produce_data);
produce_data++;
*data = produce_data;
printf ("At time %3lu:%3lu, produce : %d\n", mytime.tv_sec % 3600, mytime.tv_nsec/1000000,produce_data);
#else
printf ("Produce %d\n", data);
#endif
produce_data++;
}
void user_consume_spg (int data)
{
#if defined (POSIX)
struct timespec mytime;
clock_gettime (CLOCK_REALTIME, &mytime);
printf( "At time %3lu:%3lu, consume : %d\n", mytime.tv_sec % 3600 , mytime.tv_nsec/1000000,data);
#else
printf ("Consume %d\n", data);
#endif
}
......@@ -14,7 +14,11 @@
#include <po_hi_types.h>
#ifndef HAVE_CLOCK_GETTIME
#if defined (__CYGWIN__) || defined (__MINGW32__)
#else
#include <xlocale.h>
#endif
#include <time.h>
#endif
......
......@@ -52,14 +52,14 @@ ifeq ($(NEED_TRANSPORT),yes)
CFLAGS+=-D__PO_HI_USE_TRANSPORT
endif
INCLUDE=-I. -I"${shell $(CYGPATH_W) "${RUNTIME_PATH}/include"}"
ifdef TARGET_INCLUDE
INCLUDE=-I. -I$(RUNTIME_PATH)/include/ $(TARGET_INCLUDE)
else
INCLUDE=-I. -I$(RUNTIME_PATH)/include/
INCLUDE += $(TARGET_INCLUDE)
endif
ifdef USER_SOURCES_DIRS
INCLUDE+=$(shell for v in $(USER_SOURCES_DIRS); do echo -I$$v ; done )
INCLUDE+=$(USER_SOURCES_DIRS)
endif
INCLUDE+=$(USER_INCLUDE)
......@@ -348,3 +348,4 @@ gprof:
./$(BINARY)
gprof ./$(BINARY) > gprof.out
endif
CYGPATH_U = @CYGPATH_U@
CYGPATH_W = @CYGPATH_W@
TARGET_CFLAGS = @NATIVE_CFLAGS@
TARGET_LDFLAGS = @NATIVE_LDFLAGS@ -L$(RUNTIME_PATH)/libs/linux32/ -L$(RUNTIME_PATH)/libs/linux64/ -llua -lm
TARGET_LDFLAGS = @NATIVE_LDFLAGS@ -lm
SIMULINK_LDFLAGS = @SIMULINK_LDFLAGS@
CC = gcc
LD = gcc
......
......@@ -14,7 +14,10 @@
/* Headers from PolyORB-HI-C */
#if defined (__CYGWIN__) || defined (__MINGW32__)
#else
#include <xlocale.h>
#endif
#include <string.h>
/* Headers from the executive */
......
......@@ -8,9 +8,13 @@
* Copyright (C) 2011-2012 ESA & ISAE.
*/
#include <po_hi_config.h>
#if defined (__CYGWIN__) || defined (__MINGW32__)
#else
#include <xlocale.h>
#endif
#include <string.h>
#include <po_hi_config.h>
#include <po_hi_debug.h>
#include <po_hi_storage.h>
#include <po_hi_returns.h>
......
......@@ -9,7 +9,11 @@
*/
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
#if defined (__CYGWIN__) || defined (__MINGW32__)
#else
#include <xlocale.h>
#endif
#include <pthread.h>
#include <sched.h>
#endif
......@@ -44,8 +48,12 @@ typedef struct
__po_hi_time_t period;
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
__po_hi_time_t timer;
#if defined (_WIN32)
DWORD tid;
#else
pthread_t tid; /* The pthread_t type used by the
POSIX library */
#endif
pthread_mutex_t mutex;
pthread_cond_t cond;
#elif defined (_WIN32)
......@@ -339,7 +347,7 @@ DWORD __po_hi_win32_create_thread (__po_hi_task_id id,
{
DWORD tid;
HANDLE h;
h = CreateThread (NULL, 0, start_routine, NULL, 0, &tid);
h = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) start_routine, NULL, 0, &tid);
__po_hi_tasks_array[id] = h;
return tid;
}
......
......@@ -8,7 +8,11 @@
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2012 ESA & ISAE.
*/
#if defined (__CYGWIN__) || defined (__MINGW32__)
#else
#include <xlocale.h>
#endif
#include <time.h>
#include <errno.h>
......@@ -260,9 +264,6 @@ int __po_hi_delay_until (const __po_hi_time_t* time)
__PO_HI_DEBUG_DEBUG("[DELAY UNTIL] CloseHandle failed (%d)\n", GetLastError());
}
printf ("wait completed\n");
return __PO_HI_SUCCESS;
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment