Skip to content

Commit

Permalink
Support 512K "RCT6" in BTT SKR Mini (MarlinFirmware#15890)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisiskeithb authored and christran206 committed Dec 30, 2019
1 parent 341bd47 commit e0c2de8
Show file tree
Hide file tree
Showing 13 changed files with 1,089 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:

# Extended STM32 Environments
- TEST_PLATFORM="STM32F103RC_bigtree"
- TEST_PLATFORM="STM32F103RC_bigtree_USB"
- TEST_PLATFORM="STM32F103RC_bigtree_NOUSB"
- TEST_PLATFORM="STM32F103RC_fysetc"
- TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="STM32F103VE_longer"
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/HAL/HAL_STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
// Defines
// ------------------------

#ifndef STM32_FLASH_SIZE
#ifdef MCU_STM32F103RE
#define STM32_FLASH_SIZE 512
#else
#define STM32_FLASH_SIZE 256
#endif
#endif

#ifdef SERIAL_USB
#ifndef USE_USB_COMPOSITE
#define UsbSerial Serial
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,13 @@
#elif MB(MKS_ROBIN_LITE)
#include "stm32/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite
#elif MB(BIGTREE_SKR_MINI_V1_1)
#include "stm32/pins_BIGTREE_SKR_MINI_V1_1.h" // STM32F1 env:STM32F103RC_bigtree
#include "stm32/pins_BIGTREE_SKR_MINI_V1_1.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_NOUSB env:STM32F103RC_bigtree_512K_NOUSB
#elif MB(BTT_SKR_MINI_E3_V1_2)
#include "stm32/pins_BTT_SKR_MINI_E3_V1_2.h" // STM32F1 env:STM32F103RC_bigtree
#include "stm32/pins_BTT_SKR_MINI_E3_V1_2.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_NOUSB env:STM32F103RC_bigtree_512K_NOUSB
#elif MB(BIGTREE_SKR_MINI_E3)
#include "stm32/pins_BIGTREE_SKR_MINI_E3.h" // STM32F1 env:STM32F103RC_bigtree
#include "stm32/pins_BIGTREE_SKR_MINI_E3.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_NOUSB env:STM32F103RC_bigtree_512K_NOUSB
#elif MB(BIGTREE_SKR_E3_DIP)
#include "stm32/pins_BIGTREE_SKR_E3_DIP.h" // STM32F1 env:STM32F103RC_bigtree
#include "stm32/pins_BIGTREE_SKR_E3_DIP.h" // STM32F1 env:STM32F103RC_bigtree env:STM32F103RC_bigtree_512K env:STM32F103RC_bigtree_NOUSB env:STM32F103RC_bigtree_512K_NOUSB
#elif MB(JGAURORA_A5S_A1)
#include "stm32/pins_JGAURORA_A5S_A1.h" // STM32F1 env:jgaurora_a5s_a1
#elif MB(FYSETC_AIO_II)
Expand Down
8 changes: 1 addition & 7 deletions Marlin/src/pins/stm32/pins_BIGTREE_SKR_E3_DIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,9 @@
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

#ifdef MCU_STM32F103RE
#define STM32_FLASH_SIZE (512 * 1024)
#else
#define STM32_FLASH_SIZE (256 * 1024)
#endif

#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE uint16(0x800) // 2KB
#define EEPROM_START_ADDRESS uint32(0x8000000 + STM32_FLASH_SIZE - 2 * EEPROM_PAGE_SIZE)
#define EEPROM_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB

Expand Down
8 changes: 1 addition & 7 deletions Marlin/src/pins/stm32/pins_BIGTREE_SKR_MINI_E3.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,9 @@
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

#ifdef MCU_STM32F103RE
#define STM32_FLASH_SIZE (512 * 1024)
#else
#define STM32_FLASH_SIZE (256 * 1024)
#endif

#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE uint16(0x800) // 2KB
#define EEPROM_START_ADDRESS uint32(0x8000000 + STM32_FLASH_SIZE - 2 * EEPROM_PAGE_SIZE)
#define EEPROM_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB

Expand Down
8 changes: 1 addition & 7 deletions Marlin/src/pins/stm32/pins_BIGTREE_SKR_MINI_V1_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,9 @@
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000

#ifdef MCU_STM32F103RE
#define STM32_FLASH_SIZE (512 * 1024)
#else
#define STM32_FLASH_SIZE (256 * 1024)
#endif

#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800) // 2KB
#define EEPROM_START_ADDRESS (0x8000000 + STM32_FLASH_SIZE - 2 * EEPROM_PAGE_SIZE)
#define EEPROM_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE)
#define E2END (EEPROM_PAGE_SIZE - 1)

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32/pins_BTT_SKR_MINI_E3_V1_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#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_START_ADDRESS uint32(0x8000000 + (STM32_FLASH_SIZE) * 1024 - 2 * EEPROM_PAGE_SIZE)
#undef E2END
#define E2END (EEPROM_PAGE_SIZE - 1) // 2KB

Expand Down
14 changes: 14 additions & 0 deletions buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI_512K.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K
}

/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);

/* Let common.inc handle the real work. */
INCLUDE common.inc
9 changes: 7 additions & 2 deletions buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import os
Import("env")

# Relocate firmware from 0x08000000 to 0x08007000
STM32_FLASH_SIZE = 256

for define in env['CPPDEFINES']:
if define[0] == "VECT_TAB_ADDR":
env['CPPDEFINES'].remove(define)
if define[0] == "STM32_FLASH_SIZE":
STM32_FLASH_SIZE = define[1]

# Relocate firmware from 0x08000000 to 0x08007000
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))

custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI.ld")
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI_" + str(STM32_FLASH_SIZE) + "K.ld")
for i, flag in enumerate(env["LINKFLAGS"]):
if "-Wl,-T" in flag:
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
Expand Down
Loading

0 comments on commit e0c2de8

Please sign in to comment.