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>
This commit is contained in:
Kevin O'Connor 2022-11-03 12:41:28 -04:00
parent 11dd273b34
commit 42e9adcfc9
8 changed files with 26 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) &&

View File

@ -42,6 +42,10 @@ config FLASH_SIZE
hex
default 0x80000
config FLASH_BOOT_ADDRESS
hex
default 0x0
config RAM_START
hex
default 0x10000000

View File

@ -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
######################################################################

View File

@ -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
}

View File

@ -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