From 7c0559c6e62506af73d0e8f22733615705664dd5 Mon Sep 17 00:00:00 2001 From: Lasse Dalegaard Date: Mon, 3 Jan 2022 23:28:54 +0100 Subject: 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 --- src/rp2040/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2