armcm_link: Rename CONFIG_FLASH_START to CONFIG_FLASH_APPLICATION_ADDRESS

Rename the build symbol name for better clarity on what it represents.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-12-14 18:44:07 -05:00
parent dc94a35752
commit 9b342c65c8
10 changed files with 45 additions and 31 deletions

View File

@ -65,11 +65,6 @@ config CLOCK_FREQ
default 120000000 if MACH_SAM4
default 300000000 if MACH_SAME70
config FLASH_START
hex
default 0x400000 if MACH_SAM4 || MACH_SAME70
default 0x80000
config FLASH_SIZE
hex
default 0x80000
@ -93,6 +88,11 @@ config STACK_SIZE
int
default 512
config FLASH_APPLICATION_ADDRESS
hex
default 0x400000 if MACH_SAM4 || MACH_SAME70
default 0x80000
choice
prompt "Communication interface"
config ATSAM_USB

View File

@ -110,6 +110,32 @@ config STACK_SIZE
int
default 512
######################################################################
# Bootloader
######################################################################
choice
prompt "Bootloader offset"
config SAMD_FLASH_START_2000
depends on MACH_SAMD21
bool "8KiB bootloader (Arduino Zero)"
config SAMD_FLASH_START_4000
bool "16KiB bootloader (Arduino M0)"
config SAMD_FLASH_START_0000
bool "No bootloader"
endchoice
config FLASH_APPLICATION_ADDRESS
hex
default 0x4000 if SAMD_FLASH_START_4000
default 0x2000 if SAMD_FLASH_START_2000
default 0x0000
######################################################################
# Clock
######################################################################
choice
prompt "Clock Reference"
config CLOCK_REF_X32K
@ -141,22 +167,10 @@ config CLOCK_FREQ
default 200000000 if SAMD51_FREQ_200
default 120000000 if MACH_SAMX5
choice
prompt "Bootloader offset"
config FLASH_START_2000
depends on MACH_SAMD21
bool "8KiB bootloader (Arduino Zero)"
config FLASH_START_4000
bool "16KiB bootloader (Arduino M0)"
config FLASH_START_0000
bool "No bootloader"
endchoice
config FLASH_START
hex
default 0x4000 if FLASH_START_4000
default 0x2000 if FLASH_START_2000
default 0x0000
######################################################################
# Communication inteface
######################################################################
choice
prompt "Communication interface"

View File

@ -14,7 +14,7 @@
void
bootloader_request(void)
{
if (!CONFIG_FLASH_START)
if (!CONFIG_FLASH_APPLICATION_ADDRESS)
return;
// Bootloader hack
irq_disable();

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_APPLICATION_ADDRESS
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 = CONFIG_FLASH_APPLICATION_ADDRESS , LENGTH = CONFIG_FLASH_SIZE
ram (rwx) : ORIGIN = CONFIG_RAM_START , LENGTH = CONFIG_RAM_SIZE
}

View File

@ -5,7 +5,7 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "armcm_reset.h" // try_request_canboot
#include "autoconf.h" // CONFIG_FLASH_START
#include "autoconf.h" // CONFIG_FLASH_APPLICATION_ADDRESS
#include "board/internal.h" // NVIC_SystemReset
#include "board/irq.h" // irq_disable
#include "command.h" // DECL_COMMAND_FLAGS
@ -17,7 +17,7 @@
static void
canboot_reset(uint64_t req_signature)
{
if (CONFIG_FLASH_START == CONFIG_FLASH_BOOT_ADDRESS)
if (CONFIG_FLASH_APPLICATION_ADDRESS == CONFIG_FLASH_BOOT_ADDRESS)
// No bootloader
return;
uint32_t *bl_vectors = (uint32_t *)CONFIG_FLASH_BOOT_ADDRESS;

View File

@ -70,7 +70,7 @@ choice
config LPC_FLASH_START_0000
bool "No bootloader"
endchoice
config FLASH_START
config FLASH_APPLICATION_ADDRESS
hex
default 0x4000 if LPC_FLASH_START_4000
default 0x0000

View File

@ -44,7 +44,7 @@ DECL_INIT(watchdog_init);
void
bootloader_request(void)
{
if (!CONFIG_FLASH_START)
if (!CONFIG_FLASH_APPLICATION_ADDRESS)
return;
try_request_canboot();
// Disable USB and pause for 5ms so host recognizes a disconnect

View File

@ -66,7 +66,7 @@ choice
config RP2040_FLASH_START_4000
bool "16KiB bootloader"
endchoice
config FLASH_START
config FLASH_APPLICATION_ADDRESS
hex
default 0x10004000 if RP2040_FLASH_START_4000
default 0x10000100

View File

@ -248,7 +248,7 @@ choice
config STM32_FLASH_START_0000
bool "No bootloader"
endchoice
config FLASH_START
config FLASH_APPLICATION_ADDRESS
hex
default 0x8000800 if STM32_FLASH_START_800
default 0x8001000 if STM32_FLASH_START_1000
@ -266,7 +266,7 @@ config FLASH_START
config ARMCM_RAM_VECTORTABLE
bool
default y if MACH_STM32F0 && FLASH_START != 0x8000000
default y if MACH_STM32F0 && FLASH_APPLICATION_ADDRESS != 0x8000000
default n

View File

@ -94,7 +94,7 @@ lib/hidflash/hid-flash:
flash: $(OUT)klipper.bin lib/hidflash/hid-flash
@echo " Flashing $< to $(FLASH_DEVICE)"
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(CONFIG_MCU) -d "$(FLASH_DEVICE)" -s "$(CONFIG_FLASH_START)" $(if $(NOSUDO),--no-sudo) $(OUT)klipper.bin
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(CONFIG_MCU) -d "$(FLASH_DEVICE)" -s "$(CONFIG_FLASH_APPLICATION_ADDRESS)" $(if $(NOSUDO),--no-sudo) $(OUT)klipper.bin
serialflash: $(OUT)klipper.bin
@echo " Flashing $< to $(FLASH_DEVICE) via stm32flash"