mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 04:52:59 +01:00
Merge pull request #17348 from krzysztof-cabaj/add-elf2uf2-tool
tools/elf2uf2: addition of new PROGRAMMER for RPi-pico
This commit is contained in:
commit
882c593575
@ -59,6 +59,22 @@ supported.
|
||||
|
||||
## Flashing the Board
|
||||
|
||||
### Flashing the Board Using the Bootloader
|
||||
|
||||
Connect the device to your Micro-USB cable while the button (labeled `BOOTSEL`
|
||||
on the silkscreen of the PCB) is pressed to enter the bootloader. The pico
|
||||
will present itself as a storage medium to the system, to which a UF2 file
|
||||
can be copied perform the flashing of the device. This can be automated by
|
||||
running:
|
||||
|
||||
```
|
||||
make BOARD=rpi-pico flash
|
||||
```
|
||||
|
||||
This is default flashing option using elf2uf2 PROGRAMMER. If the storage is
|
||||
not automatically mounted to `/media/<USER_NAME>/RPI-RP2`, you can overwrite
|
||||
the path by exporting the shell environment variable `ELF2UF2_MOUNT_PATH`.
|
||||
|
||||
### Flashing the Board Using OpenOCD
|
||||
|
||||
Currently (June 2021), only two methods for debugging via OpenOCD are supported:
|
||||
@ -67,7 +83,7 @@ Currently (June 2021), only two methods for debugging via OpenOCD are supported:
|
||||
2. Using a virtual CMSIS-DAP adapter provided by the second CPU core via
|
||||
https://github.com/majbthrd/pico-debug
|
||||
|
||||
Since option 2 requires no additional hardware, this is currently the default. However, you need to
|
||||
Option 2 requires no additional hardware however, you need to
|
||||
first "flash" the gimme-cache variant of [pico-debug](https://github.com/majbthrd/pico-debug)
|
||||
into RAM using the UF2 bootloader. For this, plug in the USB cable while holding down the BOOTSEL
|
||||
button of the Pico and copy the `pico-debug-gimmecache.uf2` from the
|
||||
@ -76,7 +92,7 @@ formatted drive the bootloader provides. Once this drive is unmounted again, thi
|
||||
the Raspberry Pi Pico showing up as CMSIS-DAP debugger. Afterwards run:
|
||||
|
||||
```
|
||||
make BOARD=rpi-pico flash
|
||||
make BOARD=rpi-pico PROGRAMMER=openocd flash
|
||||
```
|
||||
|
||||
@warning The `rpi-pico` virtual debugger is not persistent and needs to be "flashed" into RAM
|
||||
@ -87,15 +103,6 @@ make BOARD=rpi-pico flash
|
||||
The OpenOCD fork of the Raspberry Pi foundation is incompatible with OpenOCD
|
||||
configuration provided, so please stick with upstream OpenOCD.
|
||||
|
||||
### Flashing the Board Using the Bootloader
|
||||
|
||||
Connect the device to your Micro-USB cable while the button (labeled `BOOTSEL` on the silkscreen
|
||||
of the PCB) is pressed to enter the bootloader. Afterwards run:
|
||||
|
||||
```
|
||||
make BOARD=rpi-pico PROGRAMMER=uf2conv flash
|
||||
```
|
||||
|
||||
### Flashing the Board Using J-Link
|
||||
|
||||
Connect the Board to an Segger J-Link debugger, e.g. the EDU mini debugger is relatively affordable,
|
||||
|
@ -14,8 +14,8 @@ INCLUDES += -I$(RIOTCPU)/rpx0xx/include
|
||||
VECTORS_O ?= $(BINDIR)/cpu/vectors.o
|
||||
VECTORS_FILE := $(RIOTCPU)/rpx0xx/vectors.c
|
||||
|
||||
PROGRAMMERS_SUPPORTED := uf2conv openocd jlink
|
||||
PROGRAMMER ?= openocd
|
||||
PROGRAMMERS_SUPPORTED := elf2uf2 openocd jlink
|
||||
PROGRAMMER ?= elf2uf2
|
||||
OPENOCD_DEBUG_ADAPTER ?= dap
|
||||
|
||||
include $(RIOTMAKE)/arch/cortexm.inc.mk
|
||||
|
1
dist/tools/elf2uf2/.gitignore
vendored
Normal file
1
dist/tools/elf2uf2/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
elf2uf2
|
13
dist/tools/elf2uf2/Makefile
vendored
Normal file
13
dist/tools/elf2uf2/Makefile
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
PKG_NAME=elf2uf2
|
||||
PKG_URL=https://github.com/raspberrypi/pico-sdk.git
|
||||
PKG_VERSION=2062372d203b372849d573f252cf7c6dc2800c0a
|
||||
PKG_LICENSE=BSD-3-Clause
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
all: $(CURDIR)/elf2uf2
|
||||
|
||||
$(CURDIR)/elf2uf2:
|
||||
@env -i PATH="$(PATH)" cmake $(PKG_SOURCE_DIR)/tools/elf2uf2/CMakeLists.txt
|
||||
"$(MAKE)" -C "$(PKG_SOURCE_DIR)/tools/elf2uf2"
|
||||
cp $(PKG_SOURCE_DIR)/tools/elf2uf2/elf2uf2 .
|
11
dist/tools/elf2uf2/elf2uf2.sh
vendored
Executable file
11
dist/tools/elf2uf2/elf2uf2.sh
vendored
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $1 contains generated elf file - $FLASHFILE from makefile
|
||||
|
||||
ELFFILE="$1"
|
||||
UF2FILE="${UF2FILE:-${ELFFILE%%.elf}.uf2}"
|
||||
ELF2UF2_MOUNT_PATH="${ELF2UF2_MOUNT_PATH:-/media/$USER/RPI-RP2}"
|
||||
|
||||
"$(dirname "$0")"/elf2uf2 "$ELFFILE" "$UF2FILE"
|
||||
|
||||
cp "$UF2FILE" "$ELF2UF2_MOUNT_PATH"
|
15
makefiles/tools/elf2uf2.inc.mk
Normal file
15
makefiles/tools/elf2uf2.inc.mk
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
FLASHER ?= $(RIOTTOOLS)/elf2uf2/elf2uf2.sh
|
||||
|
||||
FLASHFILE ?= $(ELFFILE)
|
||||
|
||||
FFLAGS ?= $(FLASHFILE)
|
||||
|
||||
#yes elf2uf2 not elf2uf2.sh
|
||||
#the first should be downloaded from git and build
|
||||
#the secend is provided by RIOT code
|
||||
#FLASHDEPS += $(RIOTTOOLS)/elf2uf2/elf2uf2
|
||||
|
||||
ifeq ($(RIOTTOOLS)/elf2uf2/elf2uf2.sh,$(FLASHER))
|
||||
FLASHDEPS += $(RIOTTOOLS)/elf2uf2/elf2uf2
|
||||
endif
|
@ -59,3 +59,8 @@ $(RIOTTOOLS)/uf2/uf2conv.py: $(RIOTTOOLS)/uf2/Makefile
|
||||
@echo "[INFO] uf2conv.py not found - fetching it from GitHub now"
|
||||
CC= CFLAGS= $(MAKE) -C $(RIOTTOOLS)/uf2
|
||||
@echo "[INFO] uf2conv.py successfully fetched!"
|
||||
|
||||
$(RIOTTOOLS)/elf2uf2/elf2uf2: $(RIOTTOOLS)/elf2uf2/Makefile
|
||||
@echo "[INFO] elf2uf2 not found - fetching it from GitHub now"
|
||||
CC= CFLAGS= $(MAKE) -C $(RIOTTOOLS)/elf2uf2
|
||||
@echo "[INFO] elf2uf2 successfully fetched!"
|
||||
|
Loading…
Reference in New Issue
Block a user