From 9b7318710025ae85af714bb0b5f390db84ae2cd0 Mon Sep 17 00:00:00 2001 From: inmarket Date: Fri, 30 Jun 2017 19:43:51 +1000 Subject: Add compatibility with Visual Studio and make compile warning capabilities more cross platform --- demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h | 6 +++++- .../Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h | 6 +++++- demos/modules/gos/threads/main.c | 12 +++++++++--- demos/tools/uGFXnetDisplay/main.c | 6 +++++- 4 files changed, 24 insertions(+), 6 deletions(-) (limited to 'demos') diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h index ba51f0cc..833ebdb4 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h @@ -69,7 +69,11 @@ static GFXINLINE void init_board(GDisplay *g) { dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); #else - #warning "GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance." + #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT + #warning "GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance." + #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO + COMPILER_WARNING("GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance.") + #endif #endif #else #error "GDISP: SSD1289 - FSMC not implemented for this device" diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h index b1f2a8b5..a74507e5 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h @@ -69,7 +69,11 @@ static GFXINLINE void init_board(GDisplay *g) { dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); #else - #warning "GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance." + #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT + #warning "GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance." + #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO + COMPILER_WARNING("GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance.") + #endif #endif #else #error "GDISP: SSD1289 - FSMC not implemented for this device" diff --git a/demos/modules/gos/threads/main.c b/demos/modules/gos/threads/main.c index b15c656d..97b1c7e4 100644 --- a/demos/modules/gos/threads/main.c +++ b/demos/modules/gos/threads/main.c @@ -10,9 +10,15 @@ // Instead we use the Win32 API directly as that always works. #define DEBUGWRITE(str) WriteFile(GetStdHandle(STD_ERROR_HANDLE), str, strlen(str), &nres, 0) #else - #warning "You must alter this demo to define a DEBUGWRITE macro for your platform." - #warning "Be careful of using C library functions as they sometimes crash if they are not expecting stack changes (if possible use a multi-thread aware C library)" - #warning "You might flash LED's instead if that is better for your platform." + #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT + #warning "You must alter this demo to define a DEBUGWRITE macro for your platform." + #warning "Be careful of using C library functions as they sometimes crash if they are not expecting stack changes (if possible use a multi-thread aware C library)" + #warning "You might flash LED's instead if that is better for your platform." + #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO + COMPILER_WARNING("You must alter this demo to define a DEBUGWRITE macro for your platform.") + COMPILER_WARNING("Be careful of using C library functions as they sometimes crash if they are not expecting stack changes (if possible use a multi-thread aware C library)") + COMPILER_WARNING("You might flash LED's instead if that is better for your platform.") + #endif #error "--" #endif diff --git a/demos/tools/uGFXnetDisplay/main.c b/demos/tools/uGFXnetDisplay/main.c index d8a2976d..26ae4b89 100644 --- a/demos/tools/uGFXnetDisplay/main.c +++ b/demos/tools/uGFXnetDisplay/main.c @@ -97,7 +97,11 @@ // Mutex protection is required for LWIP #if !GDISP_GFXNET_UNSAFE_SOCKETS - #warning "GDISP: uGFXnet - LWIP sockets are not thread-safe. GDISP_GFXNET_UNSAFE_SOCKETS has been turned on for you." + #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT + #warning "GDISP: uGFXnet - LWIP sockets are not thread-safe. GDISP_GFXNET_UNSAFE_SOCKETS has been turned on for you." + #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO + COMPILER_WARNING("GDISP: uGFXnet - LWIP sockets are not thread-safe. GDISP_GFXNET_UNSAFE_SOCKETS has been turned on for you.") + #endif #undef GDISP_GFXNET_UNSAFE_SOCKETS #define GDISP_GFXNET_UNSAFE_SOCKETS TRUE #endif -- cgit v1.2.3