From 9b342c65c8a038ff980645452ab84556376bedc7 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 14 Dec 2022 18:44:07 -0500 Subject: [PATCH] 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 --- src/atsam/Kconfig | 10 ++++---- src/atsamd/Kconfig | 44 ++++++++++++++++++++++++------------ src/atsamd/main.c | 2 +- src/generic/armcm_link.lds.S | 4 ++-- src/generic/armcm_reset.c | 4 ++-- src/lpc176x/Kconfig | 2 +- src/lpc176x/main.c | 2 +- src/rp2040/Kconfig | 2 +- src/stm32/Kconfig | 4 ++-- src/stm32/Makefile | 2 +- 10 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/atsam/Kconfig b/src/atsam/Kconfig index af3d067d..4e2e839e 100644 --- a/src/atsam/Kconfig +++ b/src/atsam/Kconfig @@ -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 diff --git a/src/atsamd/Kconfig b/src/atsamd/Kconfig index 6162f9b8..d6643ffd 100644 --- a/src/atsamd/Kconfig +++ b/src/atsamd/Kconfig @@ -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" diff --git a/src/atsamd/main.c b/src/atsamd/main.c index 37b6cc8b..96af22a0 100644 --- a/src/atsamd/main.c +++ b/src/atsamd/main.c @@ -14,7 +14,7 @@ void bootloader_request(void) { - if (!CONFIG_FLASH_START) + if (!CONFIG_FLASH_APPLICATION_ADDRESS) return; // Bootloader hack irq_disable(); diff --git a/src/generic/armcm_link.lds.S b/src/generic/armcm_link.lds.S index eb3962ad..2f789f13 100644 --- a/src/generic/armcm_link.lds.S +++ b/src/generic/armcm_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_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 } diff --git a/src/generic/armcm_reset.c b/src/generic/armcm_reset.c index 6cd9ad8c..d747d9fc 100644 --- a/src/generic/armcm_reset.c +++ b/src/generic/armcm_reset.c @@ -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; diff --git a/src/lpc176x/Kconfig b/src/lpc176x/Kconfig index 5c950ef5..02da06da 100644 --- a/src/lpc176x/Kconfig +++ b/src/lpc176x/Kconfig @@ -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 diff --git a/src/lpc176x/main.c b/src/lpc176x/main.c index 19a166dc..7fd05c5d 100644 --- a/src/lpc176x/main.c +++ b/src/lpc176x/main.c @@ -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 diff --git a/src/rp2040/Kconfig b/src/rp2040/Kconfig index b42e6b21..904699f8 100644 --- a/src/rp2040/Kconfig +++ b/src/rp2040/Kconfig @@ -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 diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 364fd9fb..83bf6449 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -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 diff --git a/src/stm32/Makefile b/src/stm32/Makefile index 9642eabd..d9efd085 100644 --- a/src/stm32/Makefile +++ b/src/stm32/Makefile @@ -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"