From 995230f5971995e41b97d14273f2dd3693ead6be Mon Sep 17 00:00:00 2001
From: George Fu <nailao_5918@163.com>
Date: Wed, 13 Oct 2021 09:32:54 +0800
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20FYSETC=20Cheetah=20v2.0=20?=
 =?UTF-8?q?build=20(#22926)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json     | 3 +--
 .../PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld  | 2 +-
 ini/stm32f4.ini                                                | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json b/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json
index e7b0d28afef..6c2e093c3ba 100644
--- a/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json
+++ b/buildroot/share/PlatformIO/boards/marlin_FYSETC_CHEETAH_V20.json
@@ -14,7 +14,6 @@
         "0x3748"
       ]
     ],
-    "ldscript": "stm32f401rc.ld",
     "mcu": "stm32f401rct6",
     "variant": "MARLIN_FYSETC_CHEETAH_V20"
   },
@@ -56,7 +55,7 @@
       "dfu",
       "jlink"
     ],
-	"offset_address": "0x800C000",
+	"offset_address": "0x8008000",
     "require_upload_port": true,
     "use_1200bps_touch": false,
     "wait_for_upload_port": false
diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld
index 9565cd89c69..eaaff196cd0 100644
--- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld
+++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/ldscript.ld
@@ -61,7 +61,7 @@ _Min_Stack_Size = 0x400;; /* required amount of stack */
 /* Specify the memory areas */
 MEMORY
 {
-FLASH (rx)      : ORIGIN = 0x800C000, LENGTH = 256K
+FLASH (rx)      : ORIGIN = 0x8008000, LENGTH = 256K - 32K
 RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 64K
 }
 
diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini
index 7ff0443df62..09313b020f9 100644
--- a/ini/stm32f4.ini
+++ b/ini/stm32f4.ini
@@ -48,7 +48,7 @@ build_flags       = ${stm32_variant.build_flags}
 platform           = ${common_stm32.platform}
 extends            = stm32_variant
 board              = marlin_FYSETC_CHEETAH_V20
-board_build.offset = 0xC000
+board_build.offset = 0x8000
 build_flags        = ${stm32_variant.build_flags} -DSTM32F401xC
 
 #