wget https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh
sudo apt-get update
sudo apt-get install pkg-config
Create a directory called pico
Install required dependencies
Download the pico-sdk, pico-examples, pico-extras, and pico-playground repositories
Define PICO_SDK_PATH, PICO_EXAMPLES_PATH, PICO_EXTRAS_PATH, and PICO_PLAYGROUND_PATH in your ~/.bashrc
Build the blink and hello_world examples in pico-examples/build/blink and pico-examples/build/hello_world
Download and build picotool (see getting-started-with-pico.pdf Appendix B), and copy it to /usr/local/bin.
Download and build debugprobe (see getting-started-with-pico.pdf Appendix A).
Download and compile OpenOCD (for debug support)
Download and install Visual Studio Code
Install the required Visual Studio Code extensions (see getting-started-with-pico.pdf Chapter 7 for more details)
Configure the Raspberry Pi UART for use with Raspberry Pi Pico
2. 按图连接条线 (左 Pico A,右 Pico B)
3. 将debugprobe固件写入 Pico A
下载 debugprobe_on_pico.uf2 文件
拷贝debugprobe_on_pico.uf2到Pico A
按住 BOOTSEL 按钮,将连接电脑USB线插入Pico A
出现RPI-RP2盘符,将debugprobe_on_pico.uf2文件拖拽到RPI-RP2盘符
Pico A 自动重启
cd ~/pico/pico-examples/
rm -rf build
mkdir build
cd build
export PICO_SDK_PATH=../../pico-sdk
cmake -DCMAKE_BUILD_TYPE=Debug ..
cd blink
make -j4
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program blink.elf verify reset exit"
参数
功能
cmsis-dap.cfg
调用的类型文件(Pico A)
rp2040.cfg
调用的类型文件(Pico B)
adapter speed 5000
速率
program blink.elf
程序 blink.elf
verify
校验
reset
重置
exit
退出
更多例子
cd 到 ~/pico/pico-examples/build 目录下,编译全部实例
cd ~/pico/pico-examples/build
make -j4
烧录 blink 目录下 blink.elf 文件
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program blink/blink.elf verify reset exit"
烧录 hello_world 目录下 serial 下的 hello_serial.elf 文件
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program hello_world/serial/hello_serial.elf verify reset exit"
1. 下载 vscode_pico_example, 用 VSCODE 打开 vscode_pico_example
2. 在VSCODE里安装 CMake Tools
* 1. 配置 Configure(default cmake_vscode_pico_example)
sudo openocd -f openocd.cfg
1. 点击 Start Debugging(VSCODE -- DEBUG -- 绿色三角形)
2. 点击 Continue 按钮 (调试工具栏 -- 第二个按钮)
1. CMake Tools -- 设置 Debug 为 hello_serial
sudo minicom -D /dev/ttyACM0