Unverified Commit e95248a7 authored by Maximilian Gerhardt's avatar Maximilian Gerhardt Committed by GitHub

Support and Document pico-debug in PlatformIO (#1427)

parent 414ff231
......@@ -342,6 +342,7 @@ To specify the debugging adapter, use ``debug_tool`` (`documentation <https://do
* ``jlink``
* ``raspberrypi-swd``
* ``blackmagic``
* ``pico-debug``
These values can also be used in ``upload_protocol`` if you want PlatformIO to upload the regular firmware through this method, which you likely want.
......@@ -361,6 +362,25 @@ For further information on customizing debug options, like the initial breakpoin
You can obtain precompiled binaries from `here <https://github.com/blackmagic-debug/blackmagic/issues/1364#issuecomment-1503372723>`__. A flashing guide is available `here <https://primalcortex.wordpress.com/2017/06/13/building-a-black-magic-debug-probe/>`__. You then have to configure the target serial port ("GDB port") in your project per `documentation <https://docs.platformio.org/en/latest/plus/debug-tools/blackmagic.html#debugging-tool-blackmagic>`__.
.. note::
For the pico-debug (`download <https://github.com/majbthrd/pico-debug/releases>`__) debugging way, *which needs to no additional debug probe*, add this snippet to your ``platformio.ini`` and follow the given procedure:
.. code:: ini
upload_protocol = pico-debug
debug_tool = pico-debug
build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
1. Build your firmware normally
2. Plug in the Pico in BOOTSEL mode
3. Drag and drop your ``.pio/build/<env>/firmware.uf2`` onto the boot drive
4. Unplug and replug your Pico back into BOOTSEL mode for the second time
5. Drag and drop the downloaded ``pico-debug-gimmecache.uf2`` file onto the boot drive
6. A CMSIS-DAP device should now appear on your computer
7. Start debugging via the debug sidebar as normal
Note the restrictions: The second core cannot be used, the USB port cannot be used (no USB serial, only UART serial), 16KB less RAM is available.
Filesystem Uploading
--------------------
......@@ -375,3 +395,7 @@ The files you want to upload should be placed in a folder called ``data`` inside
The task "Build Filesystem Image" will take all files in the data directory and create a ``littlefs.bin`` file from it using the ``mklittlefs`` tool.
The task "Upload Filesystem Image" will upload the filesystem image to the Pico via the specified ``upload_protocol``.
.. note::
Set the space available for the filesystem in the ``platformio.ini`` using e.g., ``board_build.filesystem_size = 0.5m``, or filesystem
creation will fail!
\ No newline at end of file
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x1209",
"usb_pid": "0x1209"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_ELECTRONICCATS_BOMBERCAT -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x1209",
"0x1209"
]
],
"mcu": "rp2040",
"variant": "electroniccats_bombercat"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "HunterCat NFC RP2040",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 2097152,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "ElectronicCats"
}
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -47,7 +47,8 @@
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -298,7 +298,8 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
......
......@@ -21,8 +21,17 @@ platform = env.PioPlatform()
board = env.BoardConfig()
upload_protocol = env.subst("$UPLOAD_PROTOCOL") or "picotool"
#ram_size = board.get("upload.maximum_ram_size") # PlatformIO gives 264K here
# override to correct 256K for RAM section in linkerscript
ram_size = 256 * 1024 # not the 264K, which is 256K SRAM + 2*4K SCRATCH(X/Y).
# but the RAM size we need is without the SCRATCH memory.
if upload_protocol == "pico-debug":
ram_size = 240 * 1024 # pico-debug needs 16K of the upper memory for itself with pico-debug-gimmecache.uf2
# this only works when the user disables the USB stack.
if "PIO_FRAMEWORK_ARDUINO_NO_USB" not in env.Flatten(env.get("CPPDEFINES", [])):
sys.stderr.write("Must define PIO_FRAMEWORK_ARDUINO_NO_USB when using pico-debug!\n")
env.Exit(-1)
else:
ram_size = 256 * 1024 # not the 264K, which is 256K SRAM + 2*4K SCRATCH(X/Y).
# Update available RAM size
board.update("upload.maximum_ram_size", ram_size)
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinopico")
assert os.path.isdir(FRAMEWORK_DIR)
......@@ -182,7 +191,6 @@ else:
def configure_usb_flags(cpp_defines):
global ram_size
if "USE_TINYUSB" in cpp_defines:
env.Append(CPPPATH=[os.path.join(
FRAMEWORK_DIR, "libraries", "Adafruit_TinyUSB_Arduino", "src", "arduino")])
......@@ -221,10 +229,9 @@ def configure_usb_flags(cpp_defines):
pidtouse = usb_pid
if upload_protocol == "picoprobe":
pidtouse = '0x0004'
elif upload_protocol == "picodebug":
elif upload_protocol == "pico-debug":
vidtouse = '0x1209'
pidtouse = '0x2488'
ram_size = 240 * 1024
env.Append(CPPDEFINES=[
("CFG_TUSB_MCU", "OPT_MCU_RP2040"),
......@@ -245,7 +252,6 @@ def configure_usb_flags(cpp_defines):
hw_ids[0][0] = vidtouse
hw_ids[0][1] = pidtouse
board.update("build.hwids", hw_ids)
board.update("upload.maximum_ram_size", ram_size)
def configure_network_flags(cpp_defines):
env.Append(CPPDEFINES=[
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment