diff --git a/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h b/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h index 61807f026d..e3cfe00e61 100644 --- a/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h @@ -160,9 +160,6 @@ uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-function" - /* extern "C" { int freeMemory(void); @@ -172,14 +169,17 @@ extern "C" { extern "C" char* _sbrk(int incr); /* -static int freeMemory() { +int freeMemory() { volatile int top; top = (int)((char*)&top - reinterpret_cast(_sbrk(0))); return top; } */ -static int freeMemory() { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + +static inline int freeMemory(void) { volatile char top; return &top - reinterpret_cast(_sbrk(0)); } diff --git a/Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h b/Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h index d65900540d..566f1a0851 100644 --- a/Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h +++ b/Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h @@ -27,6 +27,10 @@ * These use GPIO functions instead of Direct Port Manipulation, as on AVR. */ +#ifndef PWM + #define PWM OUTPUT +#endif + #define READ(IO) digitalRead(IO) #define WRITE(IO,V) digitalWrite(IO,V) @@ -61,6 +65,8 @@ #define PORTC 2 #define PORTD 3 #define PORTE 4 +#define PORTF 5 +#define PORTG 6 #define _STM32_PIN(P,PN) ((PORT##P * 16) + PN) diff --git a/Marlin/src/HAL/shared/Marduino.h b/Marlin/src/HAL/shared/Marduino.h index 891646daab..4376579f85 100644 --- a/Marlin/src/HAL/shared/Marduino.h +++ b/Marlin/src/HAL/shared/Marduino.h @@ -31,6 +31,7 @@ #undef sq // Redefined by teensy3/wiring.h #undef SBI // Redefined by arduino/const_functions.h #undef CBI // Redefined by arduino/const_functions.h +#undef UNUSED // Redefined by stm32f4xx_hal_def.h #include // NOTE: If included earlier then this line is a NOOP @@ -74,3 +75,8 @@ #ifndef M_PI #define M_PI 3.14159265358979323846f #endif + +// Remove compiler warning on an unused variable +#ifndef UNUSED + #define UNUSED(x) ((void)(x)) +#endif diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index eb2b41d65b..ce72247c5d 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -53,15 +53,6 @@ // Nanoseconds per cycle #define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU) -// Remove compiler warning on an unused variable -#ifndef UNUSED - #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) - #define UNUSED(X) (void)X - #else - #define UNUSED(x) ((void)(x)) - #endif -#endif - // Macros to make a string from a macro #define STRINGIFY_(M) #M #define STRINGIFY(M) STRINGIFY_(M) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index d917ecb107..19755dd68c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -390,11 +390,11 @@ #error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h." #endif -#define BOARD_MKS_13 -1109 -#define BOARD_TRIGORILLA -1131 -#define BOARD_RURAMPS4D -3020 -#define BOARD_FORMBOT_TREX2 -1125 -#define BOARD_BIQU_SKR_V1_1 -2014 +#define BOARD_MKS_13 -1000 +#define BOARD_TRIGORILLA -1001 +#define BOARD_RURAMPS4D -1002 +#define BOARD_FORMBOT_TREX2 -1003 +#define BOARD_BIQU_SKR_V1_1 -1004 #if MB(MKS_13) #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." #elif MB(TRIGORILLA) @@ -403,8 +403,8 @@ #error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration." #elif MB(FORMBOT_TREX2) #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration." -#elif MB(BOARD_BIQU_SKR_V1_1) - #error "BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration." +#elif MB(BIQU_SKR_V1_1) + #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration." #endif #undef BOARD_MKS_13 #undef BOARD_TRIGORILLA diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 215ab29a2f..15048725f6 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -63,7 +63,10 @@ #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn #endif - uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + #ifdef TARGET_LPC1768 + uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + #endif + #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn #if PIN_EXISTS(FSMC_CS) @@ -73,7 +76,8 @@ #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn #endif -#elif TARGET_LPC1768 +#elif defined(TARGET_LPC1768) + uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn @@ -92,6 +96,7 @@ #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn #else // need to give them some definition or else get compiler errors + uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn #define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn @@ -99,4 +104,5 @@ #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn + #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 1ed9e32d24..0c40709625 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -45,7 +45,7 @@ * 7 | 11 */ -#if ENABLED(TARGET_LPC1768) +#ifdef TARGET_LPC1768 #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768." #elif defined(__STM32F1__) #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1." diff --git a/Marlin/src/pins/stm32/pins_STM32F4.h b/Marlin/src/pins/stm32/pins_STM32F4.h index 43875ac3b4..48ae32f108 100644 --- a/Marlin/src/pins/stm32/pins_STM32F4.h +++ b/Marlin/src/pins/stm32/pins_STM32F4.h @@ -32,7 +32,9 @@ //#define I2C_EEPROM -#define E2END 0xFFF // 4KB +#ifndef E2END + #define E2END 0xFFF // 4KB +#endif // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000