Browse Source

Safe changes from HAL cleanup

pull/1/head
Scott Lahteine 5 years ago
parent
commit
1d8ad7cf71
  1. 10
      Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h
  2. 6
      Marlin/src/HAL/HAL_STM32_F4_F7/fastio_STM32_F4_F7.h
  3. 6
      Marlin/src/HAL/shared/Marduino.h
  4. 9
      Marlin/src/core/macros.h
  5. 14
      Marlin/src/inc/SanityCheck.h
  6. 8
      Marlin/src/lcd/dogm/HAL_LCD_com_defines.h
  7. 2
      Marlin/src/pins/ramps/pins_RAMPS.h
  8. 2
      Marlin/src/pins/stm32/pins_STM32F4.h

10
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); void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
/* /*
extern "C" { extern "C" {
int freeMemory(void); int freeMemory(void);
@ -172,14 +169,17 @@ extern "C" {
extern "C" char* _sbrk(int incr); extern "C" char* _sbrk(int incr);
/* /*
static int freeMemory() { int freeMemory() {
volatile int top; volatile int top;
top = (int)((char*)&top - reinterpret_cast<char*>(_sbrk(0))); top = (int)((char*)&top - reinterpret_cast<char*>(_sbrk(0)));
return top; return top;
} }
*/ */
static int freeMemory() { #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static inline int freeMemory(void) {
volatile char top; volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }

6
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. * These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/ */
#ifndef PWM
#define PWM OUTPUT
#endif
#define READ(IO) digitalRead(IO) #define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V) #define WRITE(IO,V) digitalWrite(IO,V)
@ -61,6 +65,8 @@
#define PORTC 2 #define PORTC 2
#define PORTD 3 #define PORTD 3
#define PORTE 4 #define PORTE 4
#define PORTF 5
#define PORTG 6
#define _STM32_PIN(P,PN) ((PORT##P * 16) + PN) #define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)

6
Marlin/src/HAL/shared/Marduino.h

@ -31,6 +31,7 @@
#undef sq // Redefined by teensy3/wiring.h #undef sq // Redefined by teensy3/wiring.h
#undef SBI // Redefined by arduino/const_functions.h #undef SBI // Redefined by arduino/const_functions.h
#undef CBI // Redefined by arduino/const_functions.h #undef CBI // Redefined by arduino/const_functions.h
#undef UNUSED // Redefined by stm32f4xx_hal_def.h
#include <Arduino.h> // NOTE: If included earlier then this line is a NOOP #include <Arduino.h> // NOTE: If included earlier then this line is a NOOP
@ -74,3 +75,8 @@
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846f #define M_PI 3.14159265358979323846f
#endif #endif
// Remove compiler warning on an unused variable
#ifndef UNUSED
#define UNUSED(x) ((void)(x))
#endif

9
Marlin/src/core/macros.h

@ -53,15 +53,6 @@
// Nanoseconds per cycle // Nanoseconds per cycle
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU) #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 // Macros to make a string from a macro
#define STRINGIFY_(M) #M #define STRINGIFY_(M) #M
#define STRINGIFY(M) STRINGIFY_(M) #define STRINGIFY(M) STRINGIFY_(M)

14
Marlin/src/inc/SanityCheck.h

@ -390,11 +390,11 @@
#error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h." #error "STRING_SPLASH_LINE[12] are now obsolete. Please remove them from Configuration.h."
#endif #endif
#define BOARD_MKS_13 -1109 #define BOARD_MKS_13 -1000
#define BOARD_TRIGORILLA -1131 #define BOARD_TRIGORILLA -1001
#define BOARD_RURAMPS4D -3020 #define BOARD_RURAMPS4D -1002
#define BOARD_FORMBOT_TREX2 -1125 #define BOARD_FORMBOT_TREX2 -1003
#define BOARD_BIQU_SKR_V1_1 -2014 #define BOARD_BIQU_SKR_V1_1 -1004
#if MB(MKS_13) #if MB(MKS_13)
#error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration."
#elif MB(TRIGORILLA) #elif MB(TRIGORILLA)
@ -403,8 +403,8 @@
#error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration." #error "BOARD_RURAMPS4D has been renamed BOARD_RURAMPS4D_11. Please update your configuration."
#elif MB(FORMBOT_TREX2) #elif MB(FORMBOT_TREX2)
#error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration." #error "FORMBOT_TREX2 has been renamed BOARD_FORMBOT_TREX2PLUS. Please update your configuration."
#elif MB(BOARD_BIQU_SKR_V1_1) #elif MB(BIQU_SKR_V1_1)
#error "BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration." #error "BOARD_BIQU_SKR_V1_1 has been renamed BOARD_BIGTREE_SKR_V1_1. Please update your configuration."
#endif #endif
#undef BOARD_MKS_13 #undef BOARD_MKS_13
#undef BOARD_TRIGORILLA #undef BOARD_TRIGORILLA

8
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 #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
#endif #endif
#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); 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 #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
#if PIN_EXISTS(FSMC_CS) #if PIN_EXISTS(FSMC_CS)
@ -73,7 +76,8 @@
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
#endif #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); 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 #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 #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
#else // need to give them some definition or else get compiler errors #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); 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_SW_SPI_FN u8g_com_null_fn
#define U8G_COM_HAL_HW_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_ST7920_HAL_HW_SPI u8g_com_null_fn
#define U8G_COM_SSD_I2C_HAL u8g_com_null_fn #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
#define U8G_COM_HAL_FSMC_FN u8g_com_null_fn #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn
#endif #endif

2
Marlin/src/pins/ramps/pins_RAMPS.h

@ -45,7 +45,7 @@
* 7 | 11 * 7 | 11
*/ */
#if ENABLED(TARGET_LPC1768) #ifdef TARGET_LPC1768
#error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768." #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768."
#elif defined(__STM32F1__) #elif defined(__STM32F1__)
#error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1." #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1."

2
Marlin/src/pins/stm32/pins_STM32F4.h

@ -32,7 +32,9 @@
//#define I2C_EEPROM //#define I2C_EEPROM
#ifndef E2END
#define E2END 0xFFF // 4KB #define E2END 0xFFF // 4KB
#endif
// Ignore temp readings during development. // Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

Loading…
Cancel
Save