aboutsummaryrefslogtreecommitdiffstats
path: root/src/gos
diff options
context:
space:
mode:
authorinmarket <inmarket@ugfx.io>2017-06-30 19:43:51 +1000
committerinmarket <inmarket@ugfx.io>2017-06-30 19:43:51 +1000
commit9b7318710025ae85af714bb0b5f390db84ae2cd0 (patch)
treef7b1849a40c0019d048761f9493f6d15695703cd /src/gos
parente5497f2ac058acb427b6fcdd15db6adeddd7bc55 (diff)
downloaduGFX-9b7318710025ae85af714bb0b5f390db84ae2cd0.tar.gz
uGFX-9b7318710025ae85af714bb0b5f390db84ae2cd0.tar.bz2
uGFX-9b7318710025ae85af714bb0b5f390db84ae2cd0.zip
Add compatibility with Visual Studio and make compile warning capabilities more cross platform
Diffstat (limited to 'src/gos')
-rw-r--r--src/gos/gos_arduino.c6
-rw-r--r--src/gos/gos_chibios.c6
-rw-r--r--src/gos/gos_cmsis.c6
-rw-r--r--src/gos/gos_ecos.c6
-rw-r--r--src/gos/gos_freertos.c6
-rw-r--r--src/gos/gos_raw32.c6
-rw-r--r--src/gos/gos_rawrtos.c6
-rw-r--r--src/gos/gos_rules.h6
-rw-r--r--src/gos/gos_win32.c4
-rw-r--r--src/gos/gos_win32.h6
-rw-r--r--src/gos/gos_x_threads_cortexm01.h12
-rw-r--r--src/gos/gos_x_threads_cortexm347.h12
-rw-r--r--src/gos/gos_x_threads_cortexm47fp.h6
13 files changed, 70 insertions, 18 deletions
diff --git a/src/gos/gos_arduino.c b/src/gos/gos_arduino.c
index 2e0e4b53..0eec8957 100644
--- a/src/gos/gos_arduino.c
+++ b/src/gos/gos_arduino.c
@@ -25,7 +25,11 @@ void _gosInit(void)
* getting here!
*/
#if !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!")
+ #endif
#endif
// Start the heap allocator
diff --git a/src/gos/gos_chibios.c b/src/gos/gos_chibios.c
index 72b91dfc..d02127ab 100644
--- a/src/gos/gos_chibios.c
+++ b/src/gos/gos_chibios.c
@@ -49,7 +49,11 @@ void _gosInit(void)
}
#endif
#elif !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Operating System initialization has been turned off. Make sure you call halInit() and chSysInit() before gfxInit() in your application!"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call halInit() and chSysInit() before gfxInit() in your application!"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Operating System initialization has been turned off. Make sure you call halInit() and chSysInit() before gfxInit() in your application!")
+ #endif
#endif
}
diff --git a/src/gos/gos_cmsis.c b/src/gos/gos_cmsis.c
index 5bb10dbd..2798dcba 100644
--- a/src/gos/gos_cmsis.c
+++ b/src/gos/gos_cmsis.c
@@ -19,7 +19,11 @@ void _gosInit(void)
if (!osKernelRunning())
osKernelStart();
#elif !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Operating System initialization has been turned off. Make sure you call osKernelInitialize() and osKernelStart() before gfxInit() in your application!"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call osKernelInitialize() and osKernelStart() before gfxInit() in your application!"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Operating System initialization has been turned off. Make sure you call osKernelInitialize() and osKernelStart() before gfxInit() in your application!")
+ #endif
#endif
// Set up the heap allocator
diff --git a/src/gos/gos_ecos.c b/src/gos/gos_ecos.c
index 5ca5748f..f7e557ac 100644
--- a/src/gos/gos_ecos.c
+++ b/src/gos/gos_ecos.c
@@ -15,7 +15,11 @@ void _gosInit(void)
#error "GOS: Operating System initialization for eCos is not yet implemented in uGFX. Please set GFX_OS_NO_INIT to TRUE in your gfxconf.h"
#endif
#if !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Operating System initialization has been turned off. Make sure you call cyg_scheduler_start() before gfxInit() in your application!"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call cyg_scheduler_start() before gfxInit() in your application!"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Operating System initialization has been turned off. Make sure you call cyg_scheduler_start() before gfxInit() in your application!")
+ #endif
#endif
}
diff --git a/src/gos/gos_freertos.c b/src/gos/gos_freertos.c
index 7c47aa40..ff424e70 100644
--- a/src/gos/gos_freertos.c
+++ b/src/gos/gos_freertos.c
@@ -33,7 +33,11 @@
void _gosInit(void)
{
#if GFX_OS_NO_INIT && !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Operating System initialization has been turned off. Make sure you call vTaskStartScheduler()."
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call vTaskStartScheduler()."
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Operating System initialization has been turned off. Make sure you call vTaskStartScheduler().")
+ #endif
#endif
}
diff --git a/src/gos/gos_raw32.c b/src/gos/gos_raw32.c
index af9a2442..72edbb83 100644
--- a/src/gos/gos_raw32.c
+++ b/src/gos/gos_raw32.c
@@ -26,7 +26,11 @@ void _gosInit(void)
* getting here!
*/
#if !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!")
+ #endif
#endif
// Set up the heap allocator
diff --git a/src/gos/gos_rawrtos.c b/src/gos/gos_rawrtos.c
index ad646a7d..23b0c6c1 100644
--- a/src/gos/gos_rawrtos.c
+++ b/src/gos/gos_rawrtos.c
@@ -28,7 +28,11 @@ void _gosInit(void)
#error "GOS: Operating System initialization for RawRTOS is not yet implemented in uGFX. Please set GFX_OS_NO_INIT to TRUE in your gfxconf.h"
#endif
#if !GFX_OS_INIT_NO_WARNING
- #warning "GOS: Operating System initialization has been turned off. Make sure you call raw_os_start() before gfxInit() in your application!"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call raw_os_start() before gfxInit() in your application!"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Operating System initialization has been turned off. Make sure you call raw_os_start() before gfxInit() in your application!")
+ #endif
#endif
}
diff --git a/src/gos/gos_rules.h b/src/gos/gos_rules.h
index b4b8e445..6779045d 100644
--- a/src/gos/gos_rules.h
+++ b/src/gos/gos_rules.h
@@ -32,7 +32,11 @@
#if GFX_USE_OS_WIN32 || GFX_USE_OS_LINUX || GFX_USE_OS_OSX || GFX_USE_OS_ECOS || \
(GFX_OS_HEAP_SIZE == 0 && (GFX_USE_OS_RAW32 || GFX_USE_OS_ARDUINO || GFX_USE_OS_CMSIS || GFX_USE_OS_KEIL))
#if GFX_DISPLAY_RULE_WARNINGS
- #warning "GOS: Cannot emulate malloc as gfxAlloc() internally uses malloc on this platform"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS: Cannot emulate malloc as gfxAlloc() internally uses malloc on this platform"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS: Cannot emulate malloc as gfxAlloc() internally uses malloc on this platform")
+ #endif
#endif
#undef GFX_EMULATE_MALLOC
#define GFX_EMULATE_MALLOC FALSE
diff --git a/src/gos/gos_win32.c b/src/gos/gos_win32.c
index 5eecca88..ba4bbec2 100644
--- a/src/gos/gos_win32.c
+++ b/src/gos/gos_win32.c
@@ -78,7 +78,7 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms) {
return WaitForSingleObject(*psem, ms) == WAIT_OBJECT_0;
}
-typedef LONG __stdcall (*_NtQuerySemaphore)(
+typedef LONG (__stdcall *_NtQuerySemaphore)(
HANDLE SemaphoreHandle,
DWORD SemaphoreInformationClass, /* Would be SEMAPHORE_INFORMATION_CLASS */
PVOID SemaphoreInformation, /* but this is to much to dump here */
@@ -101,7 +101,7 @@ semcount_t gfxSemCounter(gfxSem *pSem) {
return BasicInfo.CurrentCount;
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
(void) stackarea;
HANDLE thd;
diff --git a/src/gos/gos_win32.h b/src/gos/gos_win32.h
index bac74d46..e6e45d2f 100644
--- a/src/gos/gos_win32.h
+++ b/src/gos/gos_win32.h
@@ -46,8 +46,8 @@ typedef LONG semcount_t;
typedef DWORD threadreturn_t;
typedef int threadpriority_t;
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t WINAPI fnName(void *param)
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0];
+#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t (WINAPI fnName)(void *param)
+#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1];
#define THREAD_RETURN(retval) return retval
#define TIME_IMMEDIATE 0
@@ -96,7 +96,7 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms);
semcount_t gfxSemCounter(gfxSem *pSem);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
threadreturn_t gfxThreadWait(gfxThreadHandle thread);
#ifdef __cplusplus
diff --git a/src/gos/gos_x_threads_cortexm01.h b/src/gos/gos_x_threads_cortexm01.h
index 15a90b2a..8afe1864 100644
--- a/src/gos/gos_x_threads_cortexm01.h
+++ b/src/gos/gos_x_threads_cortexm01.h
@@ -13,7 +13,11 @@
*/
#if CORTEX_USE_FPU
- #warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead")
+ #endif
#endif
#if GFX_COMPILER == GFX_COMPILER_GCC || GFX_COMPILER == GFX_COMPILER_CYGWIN || GFX_COMPILER == GFX_COMPILER_MINGW32 || GFX_COMPILER == GFX_COMPILER_MINGW64
@@ -128,5 +132,9 @@
}
#else
- #warning "GOS: Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching")
+ #endif
#endif
diff --git a/src/gos/gos_x_threads_cortexm347.h b/src/gos/gos_x_threads_cortexm347.h
index 40d30138..8e9ece61 100644
--- a/src/gos/gos_x_threads_cortexm347.h
+++ b/src/gos/gos_x_threads_cortexm347.h
@@ -14,7 +14,11 @@
#if CORTEX_USE_FPU
- #warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS Threads: You have specified GFX_CPU=GFX_CPU_CORTX_M? with no hardware floating point support but CORTEX_USE_FPU is TRUE. Try using GFX_CPU_GFX_CPU_CORTEX_M?_FP instead")
+ #endif
#endif
#if GFX_COMPILER == GFX_COMPILER_GCC || GFX_COMPILER == GFX_COMPILER_CYGWIN || GFX_COMPILER == GFX_COMPILER_MINGW32 || GFX_COMPILER == GFX_COMPILER_MINGW64
@@ -91,5 +95,9 @@
}
#else
- #warning "GOS: Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching")
+ #endif
#endif
diff --git a/src/gos/gos_x_threads_cortexm47fp.h b/src/gos/gos_x_threads_cortexm47fp.h
index f5eeff80..a85615c6 100644
--- a/src/gos/gos_x_threads_cortexm47fp.h
+++ b/src/gos/gos_x_threads_cortexm47fp.h
@@ -92,5 +92,9 @@
}
#else
- #warning "GOS: Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
+ #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
+ #warning "GOS Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching"
+ #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
+ COMPILER_WARNING("GOS Threads: You have specified a specific CPU but your compiler is not supported. Defaulting to CLIB switching")
+ #endif
#endif