From 847ea583f624328f9fcc97d1354f5c2bcb991960 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 Apr 2020 15:34:44 -0500 Subject: [PATCH] STM32F103VE has 512K Flash EEPROM (#17565) --- Marlin/src/HAL/STM32F1/HAL.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 4 ++-- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h | 4 ++-- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h | 4 ++-- Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h | 5 +++-- Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h | 4 ++-- Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h | 6 +++--- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 6 +++--- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 4 ++-- platformio.ini | 13 ++++++------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index ff42beb92a..629e455871 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -52,7 +52,7 @@ // ------------------------ #ifndef STM32_FLASH_SIZE - #ifdef MCU_STM32F103RE + #if defined(MCU_STM32F103RE) || defined(MCU_STM32F103VE) #define STM32_FLASH_SIZE 512 #else #define STM32_FLASH_SIZE 256 diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index 89e184524c..569e29a96a 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -34,8 +34,8 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 #define FLASH_EEPROM_EMULATION -#define EEPROM_PAGE_SIZE uint16(0x800) // 2KB -#define EEPROM_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE) +#define EEPROM_PAGE_SIZE (0x800U) // 2KB +#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #undef E2END #define E2END (EEPROM_PAGE_SIZE - 1) // 2KB diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h index d7a72592ef..5896f38f3d 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3.h @@ -32,8 +32,8 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 #define FLASH_EEPROM_EMULATION -#define EEPROM_PAGE_SIZE uint16(0x800) // 2KB -#define EEPROM_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE) +#define EEPROM_PAGE_SIZE (0x800U) // 2KB +#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #undef E2END #define E2END (EEPROM_PAGE_SIZE - 1) // 2KB diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h index 8d2d18566d..39c70f0417 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h @@ -34,8 +34,8 @@ //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 #define FLASH_EEPROM_EMULATION -#define EEPROM_PAGE_SIZE (0x800) // 2KB -#define EEPROM_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE) +#define EEPROM_PAGE_SIZE (0x800U) // 2KB +#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define E2END (EEPROM_PAGE_SIZE - 1) // diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h index dcd1119c86..ab6757d682 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h @@ -39,10 +39,11 @@ // Flash EEPROM Emulation // #define FLASH_EEPROM_EMULATION -#define EEPROM_PAGE_SIZE uint16(0x800) // 2KB -#define EEPROM_START_ADDRESS uint32(0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) +#define EEPROM_PAGE_SIZE (0x800U) // 2KB +#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #undef E2END #define E2END (EEPROM_PAGE_SIZE - 1) // 2KB + // // Limit Switches // diff --git a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h index e726ca1831..b2cdd1c5db 100644 --- a/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h +++ b/Marlin/src/pins/stm32f1/pins_FYSETC_CHEETAH.h @@ -36,8 +36,8 @@ #define DISABLE_JTAG #define FLASH_EEPROM_EMULATION -#define EEPROM_PAGE_SIZE uint16(0x800) // 2KB -#define EEPROM_START_ADDRESS uint32(0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) +#define EEPROM_PAGE_SIZE (0x800U) // 2KB +#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #undef E2END #define E2END (EEPROM_PAGE_SIZE - 1) // 2KB diff --git a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h index 6395f6efc9..0a4382894f 100644 --- a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h +++ b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h @@ -43,10 +43,10 @@ // Enable EEPROM Emulation for this board, so that we don't overwrite factory data //#define I2C_EEPROM // AT24C64 -//#define E2END 0x7FFF // 64KB +//#define E2END 0x7FFFUL // 64KB //#define FLASH_EEPROM_EMULATION -//#define E2END 0xFFF // 4KB -//#define E2END uint32(EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE * 2) - 1) +//#define E2END 0xFFFUL // 4KB +//#define E2END (EEPROM_START_ADDRESS + (EEPROM_PAGE_SIZE) * 2UL - 1UL) //#define EEPROM_CHITCHAT //#define DEBUG_EEPROM_READWRITE diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index 83881c128d..50ac8c94be 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -159,11 +159,11 @@ #define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31 #define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32 #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) - #define E2END ((16 * EEPROM_PAGE_SIZE)-1) // Limit to 64KB for now... + #define E2END (16UL * (EEPROM_PAGE_SIZE) - 1UL) // Limit to 64KB for now... #elif ENABLED(FLASH_EEPROM_EMULATION) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) - #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) + #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define E2END (EEPROM_PAGE_SIZE - 1) #else #define E2END (0x7FFU) // On SD, Limit to 2KB, require this amount of RAM diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index 50babad274..ff210c4cff 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -40,8 +40,8 @@ #define FLASH_EEPROM_EMULATION // 2K in a AT24C16N -#define EEPROM_PAGE_SIZE (uint16)0x800 // 2048 -#define EEPROM_START_ADDRESS ((uint32)(0x8000000 + 512 * 1024 - 2 * EEPROM_PAGE_SIZE)) +#define EEPROM_PAGE_SIZE (0x800U) // 2KB +#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) #define E2END (EEPROM_PAGE_SIZE - 1) // diff --git a/platformio.ini b/platformio.ini index aab3198bfd..0828170e44 100644 --- a/platformio.ini +++ b/platformio.ini @@ -463,9 +463,9 @@ src_filter = ${common.default_src_filter} + platform = ststm32 board = genericSTM32F103VE build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py - ${common.build_flags} -DDEBUG_LEVEL=DEBUG_NONE -std=gnu++14 -MMD -ffunction-sections -fdata-sections -nostdlib - -DBOARD_generic_stm32f103v -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 - -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 + ${common.build_flags} -std=gnu++14 -ffunction-sections -fdata-sections -nostdlib -MMD + -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -DBOARD_generic_stm32f103v + -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 build_unflags = -std=gnu++11 src_filter = ${common.default_src_filter} + lib_ignore = Adafruit NeoPixel, SPI @@ -478,8 +478,7 @@ upload_protocol = serial platform = ststm32 board = genericSTM32F103VE build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py - ${common.build_flags} -std=gnu++14 -USERIAL_USB - -DSTM32F1xx -DU20 -DTS_V12 + ${common.build_flags} -std=gnu++14 -DMCU_STM32F103VE -DSTM32F1xx -USERIAL_USB -DU20 -DTS_V12 build_unflags = -std=gnu++11 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py src_filter = ${common.default_src_filter} + @@ -492,7 +491,7 @@ lib_ignore = Adafruit NeoPixel, LiquidTWI2, SPI platform = ststm32 board = genericSTM32F103VE build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py - ${common.build_flags} -std=gnu++14 + ${common.build_flags} -std=gnu++14 -DMCU_STM32F103VE build_unflags = -std=gnu++11 extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_mini.py src_filter = ${common.default_src_filter} + @@ -506,7 +505,7 @@ platform = ststm32 board = genericSTM32F103VE platform_packages = tool-stm32duino build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py - ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 + ${common.build_flags} -std=gnu++14 -DMCU_STM32F103VE -DHAVE_SW_SERIAL -DSS_TIMER=4 build_unflags = -std=gnu++11 extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py src_filter = ${common.default_src_filter} +