raspberrypi/debugprobe

GitHub: raspberrypi/debugprobe

Raspberry Pi 官方开源的调试探针固件,可将 RP2040 开发板变身为支持 SWD 调试和 UART 串口的低成本硬件调试工具。

Stars: 1099 | Forks: 303

# Debugprobe Raspberry Pi Debug Probe SWD/UART 配件的固件源码。也可以在 Raspberry Pi Pico 或 Pico 2 上运行。 [Raspberry Pi Debug Probe 产品页面](https://www.raspberrypi.com/products/debug-probe/) [Raspberry Pi Pico 产品页面](https://www.raspberrypi.com/products/raspberry-pi-pico/) [Raspberry Pi Pico 2 产品页面](https://www.raspberrypi.com/products/raspberry-pi-pico-2/) # 文档 Debug Probe 文档可在 [Raspberry Pi 微控制器文档门户](https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#about-the-debug-probe) 找到。 # 二次开发 为了进行修改或研究代码,您可能需要自行编译代码。 首先,克隆仓库: ``` git clone https://github.com/raspberrypi/debugprobe cd debugprobe ``` 初始化并更新子模块: ``` git submodule update --init --recursive ``` 然后创建并切换到构建目录: ``` mkdir build cd build ``` 如果您的环境中不包含 `PICO_SDK_PATH`,则可以使用 `export PICO_SDK_PATH=/path/to/sdk` 将其添加到环境变量中,或者在下面的 CMake 参数中添加 `-DPICO_SDK_PATH=/path/to/sdk`。 运行 cmake 并构建代码: ``` cmake .. make ``` 完成!您现在应该拥有一个 `debugprobe.uf2` 文件,可以通过 UF2 bootloader 将其上传到您的 Debug Probe。 ## 为 Pico 1 构建 如果您想创建在 Pico 上运行的版本,则需要在上面的 `cmake` 步骤中使用 `DEBUG_ON_PICO=ON` 选项: ``` cmake -DDEBUG_ON_PICO=ON .. ``` 这将使用 Pico 的配置进行构建,并将输出程序命名为 `debugprobe_on_pico.uf2`,以区别于配件硬件的 `debugprobe.uf2`。 请注意,如果您已经完成了为 Debug Probe 编译的整个流程,则不需要从头开始。只需回到 `cmake` 步骤并从那里开始即可。 ## 为 Pico 2 构建 如果使用现有的 debugprobe 克隆: - 您必须完全重新生成构建目录,或者使用不同的目录。 - 您还必须同步并更新子模块。 - `PICO_SDK_PATH` 必须指向 2.0.0 或更高版本的安装。 ``` git submodule sync git submodule update --init --recursive mkdir build-pico2 cd build-pico2 cmake -DDEBUG_ON_PICO=1 -DPICO_BOARD=pico2 ../ ``` 这将使用 Pico 2 的配置进行构建,并将输出程序命名为 `debugprobe_on_pico2.uf2`。 # AutoBaud 一种在数据到达时自动检测并设置 UART 波特率的模式。 要启用 AutoBaud,请将 USB CDC 端口配置为以下自定义波特率: ``` 9728 (0x2600) ``` 将波特率更改为任何其他值将禁用 AutoBaud。
标签:Arm Cortex-M, Bash脚本, C/C++, CMake, Pico SDK, Raspberry Pi Pico, RP2040, SWD, UART, UF2, 串口通信, 事务性I/O, 固件, 客户端加密, 客户端加密, 嵌入式开发, 开发板, 开源硬件, 微控制器, 烧录工具, 电子制作, 硬件调试, 调试探针