Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Klipper3d/klipper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-11-03 19:41:28 +0300
committerKevin O'Connor <kevin@koconnor.net>2022-11-08 17:53:04 +0300
commit42e9adcfc9963b54c71e8851e1a6a41a001531e5 (patch)
tree1ebbecfbe8eff81d4b1a5a66cc92b0e160a8d6dd
parent11dd273b34e78b82ec16d22495aa107233ac6779 (diff)
armcm_reset: Introduce Kconfig FLASH_BOOT_ADDRESS value
Specify the arm architecture flash bootup address for each chip type in Kconfig using a new FLASH_BOOT_ADDRESS setting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/atsam/Kconfig4
-rw-r--r--src/atsamd/Kconfig4
-rw-r--r--src/atsamd/usbserial.c2
-rw-r--r--src/generic/armcm_reset.c4
-rw-r--r--src/lpc176x/Kconfig4
-rw-r--r--src/rp2040/Kconfig6
-rw-r--r--src/rp2040/rp2040_link.lds.S4
-rw-r--r--src/stm32/Kconfig4
8 files changed, 26 insertions, 6 deletions
diff --git a/src/atsam/Kconfig b/src/atsam/Kconfig
index 04c3c27fe..af3d067df 100644
--- a/src/atsam/Kconfig
+++ b/src/atsam/Kconfig
@@ -74,6 +74,10 @@ config FLASH_SIZE
hex
default 0x80000
+config FLASH_BOOT_ADDRESS
+ hex
+ default 0x0
+
config RAM_START
hex
default 0x20400000 if MACH_SAME70
diff --git a/src/atsamd/Kconfig b/src/atsamd/Kconfig
index 0fa4c5d21..6162f9b84 100644
--- a/src/atsamd/Kconfig
+++ b/src/atsamd/Kconfig
@@ -91,6 +91,10 @@ config FLASH_SIZE
default 0x80000 if MACH_SAMD51G19 || MACH_SAMD51J19 || MACH_SAMD51N19 || MACH_SAME51J19
default 0x100000 if MACH_SAMD51P20 || MACH_SAME54P20
+config FLASH_BOOT_ADDRESS
+ hex
+ default 0x0
+
config RAM_START
hex
default 0x20000000
diff --git a/src/atsamd/usbserial.c b/src/atsamd/usbserial.c
index 938f8e211..460de4645 100644
--- a/src/atsamd/usbserial.c
+++ b/src/atsamd/usbserial.c
@@ -5,7 +5,7 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include <string.h> // memcpy
-#include "autoconf.h" // CONFIG_FLASH_START
+#include "autoconf.h" // CONFIG_MACH_SAMD21
#include "board/armcm_boot.h" // armcm_enable_irq
#include "board/io.h" // writeb
#include "board/usb_cdc.h" // usb_notify_ep0
diff --git a/src/generic/armcm_reset.c b/src/generic/armcm_reset.c
index 67ff5f570..6cd9ad8c8 100644
--- a/src/generic/armcm_reset.c
+++ b/src/generic/armcm_reset.c
@@ -17,10 +17,10 @@
static void
canboot_reset(uint64_t req_signature)
{
- if (!(CONFIG_FLASH_START & 0x00FFFFFF))
+ if (CONFIG_FLASH_START == CONFIG_FLASH_BOOT_ADDRESS)
// No bootloader
return;
- uint32_t *bl_vectors = (uint32_t *)(CONFIG_FLASH_START & 0xFF000000);
+ uint32_t *bl_vectors = (uint32_t *)CONFIG_FLASH_BOOT_ADDRESS;
uint64_t *boot_sig = (uint64_t *)(bl_vectors[1] - 9);
uint64_t *req_sig = (uint64_t *)bl_vectors[0];
if (boot_sig == (void *)ALIGN((size_t)boot_sig, 8) &&
diff --git a/src/lpc176x/Kconfig b/src/lpc176x/Kconfig
index d20c4dec1..2579029aa 100644
--- a/src/lpc176x/Kconfig
+++ b/src/lpc176x/Kconfig
@@ -42,6 +42,10 @@ config FLASH_SIZE
hex
default 0x80000
+config FLASH_BOOT_ADDRESS
+ hex
+ default 0x0
+
config RAM_START
hex
default 0x10000000
diff --git a/src/rp2040/Kconfig b/src/rp2040/Kconfig
index 37862d34d..148222d7e 100644
--- a/src/rp2040/Kconfig
+++ b/src/rp2040/Kconfig
@@ -31,6 +31,10 @@ config FLASH_SIZE
hex
default 0x200000
+config FLASH_BOOT_ADDRESS
+ hex
+ default 0x10000100 # Stage2 binary starts at 0x10000000
+
config RAM_START
hex
default 0x20000000
@@ -45,7 +49,7 @@ config STACK_SIZE
config FLASH_START
hex
- default 0x10000000
+ default 0x10000100
######################################################################
diff --git a/src/rp2040/rp2040_link.lds.S b/src/rp2040/rp2040_link.lds.S
index 3ffcd9092..43d6115e4 100644
--- a/src/rp2040/rp2040_link.lds.S
+++ b/src/rp2040/rp2040_link.lds.S
@@ -4,14 +4,14 @@
//
// This file may be distributed under the terms of the GNU GPLv3 license.
-#include "autoconf.h" // CONFIG_FLASH_START
+#include "autoconf.h" // CONFIG_FLASH_SIZE
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
- rom (rx) : ORIGIN = CONFIG_FLASH_START , LENGTH = CONFIG_FLASH_SIZE
+ rom (rx) : ORIGIN = 0x10000000 , LENGTH = CONFIG_FLASH_SIZE
ram (rwx) : ORIGIN = CONFIG_RAM_START , LENGTH = CONFIG_RAM_SIZE
}
diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig
index 452384074..9cdb3c312 100644
--- a/src/stm32/Kconfig
+++ b/src/stm32/Kconfig
@@ -164,6 +164,10 @@ config FLASH_SIZE
default 0x20000 if MACH_STM32H750
default 0x200000 if MACH_STM32H743
+config FLASH_BOOT_ADDRESS
+ hex
+ default 0x8000000
+
config RAM_START
hex
default 0x20000000