aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLasse Dalegaard <dalegaard@gmail.com>2022-01-03 23:28:54 +0100
committerKevinOConnor <kevin@koconnor.net>2022-01-06 17:32:54 -0500
commit7c0559c6e62506af73d0e8f22733615705664dd5 (patch)
tree67553ceb7751b4cd7601e01d7b00dd45cebeb3cd /src
parent8a3727ef742f46923275ffca4651710952cfa114 (diff)
downloadkutter-7c0559c6e62506af73d0e8f22733615705664dd5.tar.gz
kutter-7c0559c6e62506af73d0e8f22733615705664dd5.tar.xz
kutter-7c0559c6e62506af73d0e8f22733615705664dd5.zip
rp2040: add make flash support
This adds `make flash` support for the rp2040 target. Flashing is performed using a custom `rp2040_flash` tool that uses the PICOBOOT protocol. Root is not required. The user specifies the serial device of the rp2040 they wish to flash as the device. This device is reset into bootsel mode and `rp2040_flash` is invoked on the original USB device path. If the device is already in bootloader mode, the user can specify 'first' as `FLASH_DEVICE` which will simply invoke `rp2040_flash` with no bus/address options. Signed-off-by: Lasse Dalegaard <dalegaard@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/rp2040/Makefile13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rp2040/Makefile b/src/rp2040/Makefile
index b40df32d..2915b994 100644
--- a/src/rp2040/Makefile
+++ b/src/rp2040/Makefile
@@ -43,10 +43,11 @@ $(OUT)klipper.uf2: $(OUT)klipper.elf $(OUT)lib/rp2040/elf2uf2/elf2uf2
@echo " Creating uf2 file $@"
$(Q)$(OUT)lib/rp2040/elf2uf2/elf2uf2 $< $@
+lib/rp2040_flash/rp2040_flash:
+ @echo " Building rp2040_flash"
+ $(Q)make -C lib/rp2040_flash rp2040_flash
+
# Flash rules
-flash: $(OUT)klipper.uf2
- @echo "Error: Flashing not supported on rp2040."
- @echo "Place target board in bootloader mode (hold bootsel button"
- @echo "during powerup), mount the device as a usb drive, and copy"
- @echo "$< to the device."
- @exit -1
+flash: $(OUT)klipper.uf2 lib/rp2040_flash/rp2040_flash
+ @echo " Flashing $< to $(FLASH_DEVICE)"
+ $(Q)$(PYTHON) ./scripts/flash_usb.py -t $(CONFIG_MCU) -d "$(FLASH_DEVICE)" $(OUT)klipper.uf2