树莓派(Raspberry Pi)picotool

news/2024/11/19 2:44:39/

树莓派(Raspberry Pi)picotool

  • 安装
    • 直接安装
    • 从源码安装
    • 工具介绍
      • 显示信息
      • 保存程序
      • 二进制信息
      • 基本信息
      • 引脚
      • 完整信息
  • 链接

安装

直接安装

在archlinux上,使用yay直接安装

yay -S picotool

从源码安装

安装libusb

sudo pacman -S libusb

下载 pico-sdk

git clone https://github.com/raspberrypi/pico-sdk.git --branch master
cd pico-sdk
git submodule update --init
cd ..

下载 picotool 编译构建

git clone https://github.com/raspberrypi/picotool.git
cd picotool
mkdir build
cd build
export PICO_SDK_PATH=../../pico-sdk
cmake ../
make

工具介绍

$picotool help
PICOTOOL:Tool for interacting with RP2040/RP2350 device(s) in BOOTSEL mode, or with an RP2040/RP2350 binarySYNOPSIS:picotool info [-b] [-p] [-d] [--debug]  [-l] [-a] [device-selection]picotool info [-b] [-p] [-d] [--debug]  [-l] [-a] <filename> [-t <type>]picotool config [-s <key> <value>] [-g  <group>] [device-selection]picotool config [-s <key> <value>] [-g  <group>] <filename> [-t <type>]picotool load [--ignore-partitions] [--family <family_id>] [-p <partition>] [-n] [-N] [-u] [-v] [-x] <filename> [-t <type>] [-o <offset>] [device-selection]picotool encrypt [--quiet] [--verbose]  [--hash] [--sign] <infile> [-t <type>] [-o <offset>] <outfile> [-t <type>] <aes_key> [-t <type>] [<signing_key>] [-t <type>]picotool seal [--quiet] [--verbose] [--hash] [--sign] [--clear] <infile> [-t <type>] [-o <offset>] <outfile> [-t <type>] [<key>] [-t <type>] [<otp>] [-t <type>] [--major <major>] [--minor  <minor>] [--rollback <rollback>  [<rows>..]]picotool link [--quiet] [--verbose]     <outfile> [-t <type>] <infile1> [-t<type>] <infile2> [-t   <type>] [<infile3>] [-t   <type>] [-p] <pad>picotool save [-p] [device-selection]picotool save -a [device-selection]picotool save -r <from> <to>    [device-selection]picotool verify [device-selection]picotool reboot [-a] [-u] [-g   <partition>] [-c <cpu>]   [device-selection]picotool otp list|get|set|load|dump|    permissions|white-labelpicotool partition info|createpicotool uf2 info|convertpicotool version [-s] [<version>]picotool coprodis [--quiet] [--verbose]     <infile> [-t <type>] <outfile> [-t <type>]picotool help [<cmd>]COMMANDS:info          Display information from    the target device(s) or file.Without any arguments, this     will display basic  information for all connected RP2040    devices in BOOTSEL modeconfig        Display or change program   configuration settings from the target device(s) or file.load          Load the program / memory   range stored in a file onto the device.encrypt       Encrypt the program.seal          Add final metadata to a     binary, optionally including a hash and/or signature.link          Link multiple binaries into     one block loop.save          Save the program / memory   stored in flash on the device to a file.verify        Check that the device   contents match those in the file.reboot        Reboot the deviceotp           Commands related to the     RP2350 OTP (One-Time-Programmable) Memorypartition     Commands related to RP2350  Partition Tablesuf2           Commands related to UF2     creation and statusversion       Display picotool versioncoprodis      Post-process coprocessor    instructions in disassembly files.help          Show general help or help   for a specific commandUse "picotool help <cmd>" for more info
说明
大部分命令都要求将树莓派微控制器设备连接到开发设备上,并处于 BOOTSEL 模式下。
重点
如果打印错误消息 No accessible RP2040/RP2350 devices in BOOTSEL mode were found,并且伴有类似这样的提示: Device at bus 1, address 7 appears to be a RP2040 device in BOOTSEL mode, but picotool was unable to connect,这表明已连接了一个 Pico 系列设备,但是执行命令的权限不够,这时可以使用 sudo 来运行 picotool
sudo picotool info -a
如果使用的是 Windows 系统,则需要安装一个驱动程序。
下载并运行 Zadig,从下拉框中选择 RP2 Boot(Interface 1),并选择 WinUSB 作为驱动程序,然后点击 “安装驱动程序” 按钮。

picotool 的 1.1 版本开始,支持与未处于 BOOTSEL 模式的树莓派微控制器进行交互,使用 picotool-f 参数使用SDK 的USB 标准输入输出(stdio)进行交互。

显示信息

当前版本的SDK支持二进制信息,能够存储目标设备或者文件的精简信息。info 命令用于读取此类信息。

这些信息既可以从一个或多个处于 BOOTSEL 模式的已连接树莓派微控制器中读取,也可以从一个文件中读取。该文件可以是可执行与可链接格式(ELF)文件、通用闪存存储格式(UF2)文件或二进制(BIN)文件。

$picotool help info
INFO:Display information from the target device(s) or file.Without any arguments, this will display basic information for all connectedRP2040 devices in BOOTSEL modeSYNOPSIS:picotool info [-b] [-p] [-d] [--debug] [-l] [-a] [device-selection]picotool info [-b] [-p] [-d] [--debug] [-l] [-a] <filename> [-t <type>]OPTIONS:Information to display-b, --basicInclude basic information. This is the default-p, --pinsInclude pin information-d, --deviceInclude device information--debugInclude device debug information-l, --buildInclude build attributes-a, --allInclude all informationTARGET SELECTION:To target one or more connected RP2040 device(s) in BOOTSEL mode (the default)--bus <bus>Filter devices by USB bus number--address <addr>Filter devices by USB device address--vid <vid>Filter by vendor id--pid <pid>Filter by product id--ser <ser>Filter by serial number-f, --forceForce a device not in BOOTSEL mode but running compatible code to reset so the command can be executed. After executing the command (unless the command itself is a 'reboot') the device will be rebooted back to application mode-F, --force-no-rebootForce a device not in BOOTSEL mode but running compatible code to reset so the command can be executed. After executing the command (unless the command itself is a 'reboot') the device will be left connected and accessible to picotool, but without the RPI-RP2 drive mountedTo target a file<filename>The file name-t <type>Specify file type (uf2 | elf | bin) explicitly, ignoring file extension

例如,在将Pico系列设备插入 USB 接口之前,按住 BOOTSEL 按钮,使其以大容量存储模式连接到计算机。然后打开一个终端窗口并输入:

$sudo picotool info
Program Informationname: hello_worldfeatures: stdout to UART

或者

$sudo picotool info -a
Program Informationname:         hello_worldfeatures:     stdout to UARTbinary start: 0x10000000binary end:   0x1000606cFixed Pin Information20: UART1 TX21: UART1 RXBuild Informationbuild date:       Dec 31 2020build attributes: Debug buildDevice Informationflash size:  2048KROM version: 2

也可以通过如下的命令获取引脚信息。

$ sudo picotool info -bp
Program Informationname:     hello_worldfeatures: stdout to UARTFixed Pin Information20: UART1 TX21: UART1 RX

也可以查询二进制文件的信息。

$ picotool info -a lcd_1602_i2c.uf2
File lcd_1602_i2c.uf2:
Program Informationname:         lcd_1602_i2cweb site:     https://github.com/raspberrypi/pico-examples/tree/HEAD/i2c/lcd_1602_i2cbinary start: 0x10000000binary end:   0x10003c1cFixed Pin Information4: I2C0 SDA5: I2C0 SCLBuild Informationbuild date: Dec 31 2020

保存程序

“保存”功能支持将设备中的一段内存、一个程序或整个闪存内容保存到一个二进制(BIN)文件或通用闪存存储格式(UF2)文件中。

$ picotool help save
SAVE:Save the program / memory stored in flash on the device to a file.SYNOPSIS:picotool save [-p] [--bus <bus>] [--address <addr>] [-f] [-F] <filename> [-t <type>]picotool save -a [--bus <bus>] [--address <addr>] [-f] [-F] <filename> [-t <type>]picotool save -r <from> <to> [--bus <bus>] [--address <addr>] [-f] [-F] <filename> [-t <type>]OPTIONS:Selection of data to save-p, --programSave the installed program only. This is the default-a, --allSave all of flash memory-r, --rangeSave a range of memory. Note that UF2s always store complete 256 byte-aligned blocks of 256 bytes, and the range is expanded accordingly<from>The lower address bound in hex<to>The upper address bound in hexSource device selection--bus <bus>Filter devices by USB bus number--address <addr>Filter devices by USB device address-f, --forceForce a device not in BOOTSEL mode but running compatible code to reset so the command can be executed. After executing the command (unless the command itself is a 'reboot') the device will be rebooted back to application mode-F, --force-no-rebootForce a device not in BOOTSEL mode but running compatible code to reset so the command can be executed. After executing the command (unless the command itself is a 'reboot') the device will be left connected and accessible to picotool, but  without the RPI-RP2 drive mounted File to save to<filename>The file name-t <type>Specify file type (uf2 | elf | bin) explicitly, ignoring file extension

比如:

$ sudo picotool info
Program Information
name:     lcd_1602_i2c
web site: https://github.com/raspberrypi/pico-examples/tree/HEAD/i2c/lcd_1602_i2c
$ picotool save spoon.uf2
Saving file: [==============================] 100%
Wrote 51200 bytes to spoon.uf2
$ picotool info spoon.uf2
File spoon.uf2:
Program Information
name:     lcd_1602_i2c
web site: https://github.com/raspberrypi/pico-examples/tree/HEAD/i2c/lcd_1602_i2c

二进制信息

二进制信息是在构建时嵌入到二进制文件中的、可由机器定位且能被机器读取的信息。

基本信息

当拿到一个 Pico 系列设备但不知道里面有什么内容时,这些信息就非常有用了!
基本信息包括:
- 程序名称
- 程序描述
- 程序版本字符串
- 程序构建日期
- 程序网址
- 程序结束地址
- 程序特性,这是一个根据二进制文件中的各个字符串构建的列表,在 SDK 中可以显示出来(例如,我们会有一个针对通用异步收发传输器(UART)标准输入输出(stdio)的特性,以及一个针对通用串行总线(USB)标准输入输出(stdio)的特性)。
- 构建属性,及与二进制文件本身相关的内容(例如,调试构建)

引脚

当忘记可执行文件是为基于树莓派微控制器的哪种电路板构建的时,可使用picotool info --pins获取文件的引脚信息。

$ picotool info --pins sprite_demo.elf
File sprite_demo.elf:Fixed  Pin Information
0-4:   Red 0-4
6-10:  Green 0-4
11-15: Blue 0-4
16:    HSync
17:    VSync
18:    Display Enable
19:    Pixel Clock
20:    UART1 TX
21:    UART1 RX

完整信息

使用 -a 选项可获取完整信息。

$ picotool info -a i2c_bus_scan.elf
File i2c_bus_scan.elf:Program Informationname:         i2c_bus_scanweb site:     https://github.com/raspberrypi/pico-examples/tree/HEAD/i2c/bus_scanfeatures:     UART stdin / stdoutbinary start: 0x10000000binary end:   0x10004c74Fixed Pin Information0: UART0 TX1: UART0 RX4: I2C0 SDA5: I2C0 SCLBuild Informationsdk version:      2.0.0-developpico_board:       picobuild date:       Aug 1 2024build attributes: Debug

链接

  • Raspberry Pi官网

http://www.ppmy.cn/news/1548134.html

相关文章

号卡分销系统,号卡系统,物联网卡系统源码安装教程

号卡分销系统&#xff0c;号卡系统&#xff0c;物联网卡系统&#xff0c;&#xff0c;实现的高性能(PHP协程、PHP微服务)、高灵活性、前后端分离(后台)&#xff0c;PHP 持久化框架&#xff0c;助力管理系统敏捷开发&#xff0c;长期持续更新中。 主要特性 基于Auth验证的权限…

「人眼视觉不再是视频消费的唯一形式」丨智能编解码和 AI 视频生成专场回顾@RTE2024

你是否想过&#xff0c;未来你看到的电影预告片、广告&#xff0c;甚至新闻报道&#xff0c;都可能完全由 AI 生成&#xff1f; 在人工智能迅猛发展的今天&#xff0c;视频技术正经历着一场前所未有的变革。从智能编解码到虚拟数字人&#xff0c;再到 AI 驱动的视频生成&#…

Unet++改进24:添加DualConv||轻量级深度神经网络的双卷积核

本文内容:添加DualConv 目录 论文简介 1.步骤一 2.步骤二 3.步骤三 4.步骤四 论文简介 卷积神经网络(CNN)架构通常对内存和计算要求很高,这使得它们在硬件资源有限的嵌入式系统中不可行。 我们提出了双卷积核(DualConv)来构建轻量级深度神经网络。DualConv结合3 3和1…

在 Flutter 应用中调用后端接口的方法

在 Flutter 中调用后端接口通常使用 http 包来发起 HTTP 请求。以下是一个使用 http 包的基本示例&#xff0c;展示了如何在 Flutter 应用中调用后端接口并处理响应。 首先&#xff0c;确保在 pubspec.yaml 文件中添加 http 包的依赖&#xff1a; dependencies:http: ^0.13.0…

【Qualcomm 】CDSP介绍以及简单的使用

🦋产品层级 高通技术公司 (QTI) 提供大量且数量不断增加的 Snapdragon 芯片组解决方案变体。Snapdragon 移动产品系列分为五个产品层级。🌸最高层级包括 SM8xxx 系列(高级)和 SM7xxx 系列(高级)。较低层级包括 SM6xx、SM4xx 和 SM2xx 系列🌸。 上述这些产品层级的区…

spring6对bean管理自己的一些理解

在JavaWeb中&#xff0c;存在以下的开发架构&#xff1a; 什么是Spring管理Bean 在传统的Java开发中&#xff0c;你需要手动创建对象及其依赖&#xff0c;这意味着你需要编写大量的构造代码&#xff0c;并且这些对象之间的依赖关系需要手动管理。这在复杂项目中会非常麻烦&…

数据分析编程:SQL,Python or SPL?

Talk is cheap. Let’s show the code 1. 计算用户会话次数 用户行为数据表 useridaction_typeaction_timeU1059login2023-12-01 18:00:10U1092login2023-12-01 18:00:17U1069login2023-12-01 18:00:22……… 10 分钟没有任何动作或退出后 5 分钟没有登录则认为会话结束&am…

安全见闻2

声明&#xff01; 学习视频来自B站up主 泷羽sec 有兴趣的师傅可以关注一下&#xff0c;如涉及侵权马上删除文章&#xff0c;笔记只是方便各位师傅的学习和探讨&#xff0c;文章所提到的网站以及内容&#xff0c;只做学习交流&#xff0c;其他均与本人以及泷羽sec团队无关&#…