diff --git a/src/atsam/Kconfig b/src/atsam/Kconfig index 04c3c27f..af3d067d 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 0fa4c5d2..6162f9b8 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 938f8e21..460de464 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 // 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 67ff5f57..6cd9ad8c 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 d20c4dec..2579029a 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 37862d34..148222d7 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 3ffcd909..43d6115e 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 45238407..9cdb3c31 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