diff --git a/src/rp2040/Kconfig b/src/rp2040/Kconfig index 2b604e8c..95db68bc 100644 --- a/src/rp2040/Kconfig +++ b/src/rp2040/Kconfig @@ -47,6 +47,20 @@ config FLASH_START hex default 0x10000000 + +###################################################################### +# Bootloader options +###################################################################### + +config RP2040_STAGE2_FILE + string + default "boot2_w25q080.S" + +config RP2040_STAGE2_CLKDIV + int + default 2 + + ###################################################################### # Communication inteface ###################################################################### diff --git a/src/rp2040/Makefile b/src/rp2040/Makefile index f15302d1..ffc2c4c8 100644 --- a/src/rp2040/Makefile +++ b/src/rp2040/Makefile @@ -24,9 +24,10 @@ src-$(CONFIG_HAVE_GPIO_SPI) += rp2040/spi.c src-$(CONFIG_HAVE_GPIO_I2C) += rp2040/i2c.c # rp2040 stage2 building -$(OUT)stage2.o: lib/rp2040/boot_stage2/boot2_w25q080.S +STAGE2_FILE := $(shell echo $(CONFIG_RP2040_STAGE2_FILE)) +$(OUT)stage2.o: lib/rp2040/boot_stage2/$(STAGE2_FILE) $(OUT)autoconf.h @echo " Building rp2040 stage2 $@" - $(Q)$(CC) $(CFLAGS) -Ilib/rp2040/boot_stage2 -Ilib/rp2040/boot_stage2/asminclude -DPICO_FLASH_SPI_CLKDIV=2 -c $< -o $(OUT)stage2raw1.o + $(Q)$(CC) $(CFLAGS) -Ilib/rp2040/boot_stage2 -Ilib/rp2040/boot_stage2/asminclude -DPICO_FLASH_SPI_CLKDIV=$(CONFIG_RP2040_STAGE2_CLKDIV) -c $< -o $(OUT)stage2raw1.o $(Q)$(LD) $(OUT)stage2raw1.o --script=lib/rp2040/boot_stage2/boot_stage2.ld -o $(OUT)stage2raw.o $(Q)$(OBJCOPY) -O binary $(OUT)stage2raw.o $(OUT)stage2raw.bin $(Q)lib/rp2040/boot_stage2/pad_checksum -s 0xffffffff $(OUT)stage2raw.bin $(OUT)stage2.S