diff --git a/buildroot/share/PlatformIO/ldscripts/ZONESTAR_ZM3E_256K.ld b/buildroot/share/PlatformIO/ldscripts/ZONESTAR_ZM3E_256K.ld new file mode 100644 index 0000000000000..2404e7cac9bc4 --- /dev/null +++ b/buildroot/share/PlatformIO/ldscripts/ZONESTAR_ZM3E_256K.ld @@ -0,0 +1,14 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40 + rom (rx) : ORIGIN = 0x08005000, LENGTH = 256K - 20K - 4K +} + +/* 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 diff --git a/buildroot/share/PlatformIO/ldscripts/ZONESTAR_ZM3E_512K.ld b/buildroot/share/PlatformIO/ldscripts/ZONESTAR_ZM3E_512K.ld new file mode 100644 index 0000000000000..821c8ebbfe383 --- /dev/null +++ b/buildroot/share/PlatformIO/ldscripts/ZONESTAR_ZM3E_512K.ld @@ -0,0 +1,14 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40 + rom (rx) : ORIGIN = 0x08005000, LENGTH = 512K - 20K - 4K +} + +/* 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 diff --git a/buildroot/share/PlatformIO/ldscripts/custom.ld b/buildroot/share/PlatformIO/ldscripts/custom.ld deleted file mode 100644 index 5087a45c83de2..0000000000000 --- a/buildroot/share/PlatformIO/ldscripts/custom.ld +++ /dev/null @@ -1,24 +0,0 @@ -/** - * custom.ld - Linker script using custom environment defines - * - * LD_MAX_SIZE seems to be defined by the base platform build. - * - * Provided by offset_and_rename.py : - * LD_MAX_DATA_SIZE <= board_upload.maximum_ram_size - * LD_FLASH_OFFSET <= board_build.offset -- also used for marlin.relocate_vtab() - */ - -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE - rom (rx) : ORIGIN = 0x08000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET -} - -/* 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 diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 72f6e277c8539..2b11ae1989bae 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -369,7 +369,6 @@ build_flags = ${common_stm32f1.build_flags} platform = ${common_stm32f1.platform} extends = common_stm32f1 platform_packages = tool-stm32duino -board_build.ldscript = custom.ld board_build.address = 0x08005000 board_build.offset = 0x5000 board_upload.maximum_size = 237568 @@ -385,14 +384,17 @@ lib_ignore = Adafruit NeoPixel, SPI, SailfishLCD, SailfishRGB_LED platform = ${ZONESTAR_ZM3E_maple.platform} extends = ZONESTAR_ZM3E_maple board = genericSTM32F103RC +board_build.ldscript = ZONESTAR_ZM3E_256K.ld [env:STM32F103VC_ZM3E4_USB_maple] platform = ${ZONESTAR_ZM3E_maple.platform} extends = ZONESTAR_ZM3E_maple board = genericSTM32F103VC +board_build.ldscript = ZONESTAR_ZM3E_256K.ld [env:STM32F103VE_ZM3E4V2_USB_maple] platform = ${ZONESTAR_ZM3E_maple.platform} extends = ZONESTAR_ZM3E_maple board = genericSTM32F103VE +board_build.ldscript = ZONESTAR_ZM3E_512K.ld board_upload.maximum_size = 499712