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

View File

@ -110,6 +110,32 @@ config STACK_SIZE
int int
default 512 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 choice
prompt "Clock Reference" prompt "Clock Reference"
config CLOCK_REF_X32K config CLOCK_REF_X32K
@ -141,22 +167,10 @@ config CLOCK_FREQ
default 200000000 if SAMD51_FREQ_200 default 200000000 if SAMD51_FREQ_200
default 120000000 if MACH_SAMX5 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 # Communication inteface
default 0x4000 if FLASH_START_4000 ######################################################################
default 0x2000 if FLASH_START_2000
default 0x0000
choice choice
prompt "Communication interface" prompt "Communication interface"

View File

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

View File

@ -4,14 +4,14 @@
// //
// This file may be distributed under the terms of the GNU GPLv3 license. // 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_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm) OUTPUT_ARCH(arm)
MEMORY 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 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. // This file may be distributed under the terms of the GNU GPLv3 license.
#include "armcm_reset.h" // try_request_canboot #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/internal.h" // NVIC_SystemReset
#include "board/irq.h" // irq_disable #include "board/irq.h" // irq_disable
#include "command.h" // DECL_COMMAND_FLAGS #include "command.h" // DECL_COMMAND_FLAGS
@ -17,7 +17,7 @@
static void static void
canboot_reset(uint64_t req_signature) 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 // No bootloader
return; return;
uint32_t *bl_vectors = (uint32_t *)CONFIG_FLASH_BOOT_ADDRESS; uint32_t *bl_vectors = (uint32_t *)CONFIG_FLASH_BOOT_ADDRESS;

View File

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

View File

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

View File

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

View File

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

View File

@ -94,7 +94,7 @@ lib/hidflash/hid-flash:
flash: $(OUT)klipper.bin lib/hidflash/hid-flash flash: $(OUT)klipper.bin lib/hidflash/hid-flash
@echo " Flashing $< to $(FLASH_DEVICE)" @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 serialflash: $(OUT)klipper.bin
@echo " Flashing $< to $(FLASH_DEVICE) via stm32flash" @echo " Flashing $< to $(FLASH_DEVICE) via stm32flash"