aboutsummaryrefslogtreecommitdiffstats
path: root/src/rp2040
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2024-10-24 19:41:55 -0400
committerKevin O'Connor <kevin@koconnor.net>2024-11-13 14:25:59 -0500
commitc75eb53c0c6d81631849cfc49eba9b2efa93ddfb (patch)
tree27988b27e73ebd62d3e3325886a11e67c131c1de /src/rp2040
parent9f328cab9536d73df697b325fab13dd7eb550522 (diff)
downloadkutter-c75eb53c0c6d81631849cfc49eba9b2efa93ddfb.tar.gz
kutter-c75eb53c0c6d81631849cfc49eba9b2efa93ddfb.tar.xz
kutter-c75eb53c0c6d81631849cfc49eba9b2efa93ddfb.zip
lib: Update lib/rp2040 to v2.0.0 SDK release
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/rp2040')
-rw-r--r--src/rp2040/Makefile17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/rp2040/Makefile b/src/rp2040/Makefile
index 6d1434be..83c43e72 100644
--- a/src/rp2040/Makefile
+++ b/src/rp2040/Makefile
@@ -5,8 +5,13 @@ CROSS_PREFIX=arm-none-eabi-
dirs-y += src/rp2040 src/generic lib/elf2uf2 lib/fast-hash lib/can2040
+MCU := $(shell echo $(CONFIG_MCU))
+MCU_UPPER := $(shell echo $(CONFIG_MCU) | tr a-z A-Z | tr X x)
+
CFLAGS += -mcpu=cortex-m0plus -mthumb -Ilib/cmsis-core
-CFLAGS += -Ilib/rp2040 -Ilib/rp2040/cmsis_include -Ilib/fast-hash -Ilib/can2040
+CFLAGS += -Ilib/pico-sdk/$(MCU) -Ilib/pico-sdk
+CFLAGS += -Ilib/pico-sdk/$(MCU)/cmsis_include -Ilib/fast-hash -Ilib/can2040
+CFLAGS += -DPICO_$(MCU_UPPER)
# Add source files
src-y += rp2040/main.c rp2040/watchdog.c rp2040/gpio.c
@@ -28,18 +33,18 @@ src-$(CONFIG_HAVE_GPIO_I2C) += rp2040/i2c.c
# rp2040 stage2 building
STAGE2_FILE := $(shell echo $(CONFIG_RP2040_STAGE2_FILE))
-$(OUT)stage2.o: lib/rp2040/boot_stage2/$(STAGE2_FILE) $(OUT)autoconf.h
+$(OUT)stage2.o: lib/pico-sdk/$(MCU)/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=$(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)$(CC) $(CFLAGS) -Ilib/pico-sdk/$(MCU)/boot_stage2 -Ilib/pico-sdk/$(MCU)/boot_stage2/asminclude -DPICO_FLASH_SPI_CLKDIV=$(CONFIG_RP2040_STAGE2_CLKDIV) -c $< -o $(OUT)stage2raw1.o
+ $(Q)$(LD) $(OUT)stage2raw1.o --script=lib/pico-sdk/$(MCU)/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
+ $(Q)lib/pico-sdk/$(MCU)/boot_stage2/pad_checksum -s 0xffffffff $(OUT)stage2raw.bin $(OUT)stage2.S
$(Q)$(CC) $(CFLAGS) -c $(OUT)stage2.S -o $(OUT)stage2.o
# Binary output file rules when using stage2
$(OUT)lib/elf2uf2/elf2uf2: lib/elf2uf2/main.cpp
@echo " Building $@"
- $(Q)g++ -g -O -Ilib/rp2040 $< -o $@
+ $(Q)g++ -g -O -Ilib/pico-sdk $< -o $@
$(OUT)klipper.uf2: $(OUT)klipper.elf $(OUT)lib/elf2uf2/elf2uf2
@echo " Creating uf2 file $@"