คุณต้องตั้งค่า PICO_SDK_PATH ในสภาพแวดล้อมหรือส่งต่อไปยัง cmake ด้วย -DPICO_SDK_PATH=/path/to/pico-sdk
หากต้องการใช้คุณสมบัติต่างๆ เช่น การลงนามหรือการแฮช คุณจะต้องตรวจสอบให้แน่ใจว่าได้เช็คเอาท์โมดูลย่อย mbedtls ใน SDK แล้ว ซึ่งสามารถทำได้โดยการเรียกใช้สิ่งนี้จากไดเร็กทอรี SDK ของคุณ
อัพเดตโมดูลย่อย git --init lib/mbedtls
คุณต้องติดตั้ง libusb-1.0
ด้วย
ใช้เครื่องมือแพ็คเกจที่คุณชื่นชอบเพื่อติดตั้งการอ้างอิง ตัวอย่างเช่นบน Ubuntu:
sudo apt ติดตั้ง pkg-config libusb-1.0-0-dev cmake ที่จำเป็นต่อการสร้าง
จากนั้นเพียงสร้างเหมือนโปรเจ็กต์ CMake ปกติ:
mkdir buildcd buildcmake ..ทำ
บน Linux คุณสามารถเพิ่มกฎ udev เพื่อรัน picotool โดยไม่ต้องใช้ sudo:
sudo cp udev/99-picotool.rules /etc/udev/rules.d/
ดาวน์โหลด libUSB จากที่นี่ https://libusb.info/
ตั้งค่าตัวแปรสภาพแวดล้อม LIBUSB_ROOT ให้กับไดเร็กทอรีการติดตั้ง
mkdir buildcd buildcmake -G "NMake Makefiles" ..nmake
ดาวน์โหลด libUSB จากที่นี่ https://libusb.info/
ตั้งค่าตัวแปรสภาพแวดล้อม LIBUSB_ROOT ให้กับไดเร็กทอรีการติดตั้ง
mkdir buildcd buildcmake ..ทำ
ไม่จำเป็นต้องดาวน์โหลด libusb แยกต่างหากหรือตั้งค่า LIBUSB_ROOT
pacman -S $MINGW_PACKAGE_PREFIX-{toolchain,cmake,libusb}mkdir buildcd buildcmake .. -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIXcmake --build
Raspberry Pi Pico SDK (pico-sdk) เวอร์ชัน 2.0.0 ขึ้นไปใช้ picotool
เพื่อทำการแปลง ELF เป็น UF2 ที่ก่อนหน้านี้จัดการโดยเครื่องมือ elf2uf2
ใน SDK SDK ยังใช้ picotool
เพื่อแฮชและลงนามไบนารี
แม้ว่า SDK จะสามารถดาวน์โหลด picotool ได้ด้วยตัวเองต่อโปรเจ็กต์ หากคุณมีหลายโปรเจ็กต์หรือสร้างการกำหนดค่า ก็ควรติดตั้ง picotool
ชุดเดียวในเครื่อง ซึ่งสามารถทำได้ง่ายที่สุดด้วย make install
หรือ cmake --install .
- SDK จะใช้เวอร์ชันที่ติดตั้งนี้ตามค่าเริ่มต้น
หรือคุณสามารถติดตั้งในเส้นทางที่กำหนดเองผ่าน:
cmake -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR -DPICOTOOL_FLAT_INSTALL=1 ..
เพื่อให้ SDK ค้นหา picotool
ในเส้นทางที่กำหนดเองนี้ คุณจะต้องตั้งค่าตัวแปร picotool_DIR
ในโปรเจ็กต์ของคุณ โดยการตั้งค่าตัวแปรสภาพแวดล้อม picotool_DIR
โดยการส่ง -Dpicotool_DIR=$MY_INSTALL_DIR/picotool
ไปยังคำสั่ง cmake
ของคุณ หรือโดยการเพิ่ม set(picotool_DIR $MY_INSTALL_DIR/picotool)
ให้กับไฟล์ CMakeLists.txt ของคุณ
picotool
เป็นเครื่องมือสำหรับการทำงานกับไบนารี RP2040/RP2350 และโต้ตอบกับอุปกรณ์ RP2040/RP2350 เมื่ออยู่ในโหมด BOOTSEL (ในเวอร์ชัน 1.1 ของ picotool
เป็นไปได้ที่จะโต้ตอบกับอุปกรณ์ที่ไม่ได้อยู่ในโหมด BOOTSEL แต่ใช้การสนับสนุน USB stdio จาก Raspberry Pi Pico SDK โดยใช้อาร์กิวเมนต์ -f
ของ picotool
)
หมายเหตุสำหรับเอกสารเพิ่มเติมโปรดดูhttps://rptl.io/pico-get-started
$ picotool help PICOTOOL: Tool for interacting with RP2040/RP2350 device(s) in BOOTSEL mode, or with an RP2040/RP2350 binary SYNOPSIS: 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 [-p] [-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-label picotool partition info|create picotool uf2 info|convert picotool 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 mode config 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 device otp Commands related to the RP2350 OTP (One-Time-Programmable) Memory partition Commands related to RP2350 Partition Tables uf2 Commands related to UF2 creation and status version Display picotool version coprodis Post-process coprocessor instructions in dissassembly files. help Show general help or help for a specific command Use "picotool help <cmd>" for more info
หมายเหตุคำสั่งที่ไม่ทำงานกับไฟล์ต้องใช้อุปกรณ์ในโหมด BOOTSEL เพื่อเชื่อมต่อ
รองรับ ข้อมูลไบนารี ใน SDK ซึ่งช่วยให้จัดเก็บข้อมูลขนาดกะทัดรัดที่ picotool
สามารถค้นหาได้อย่างง่ายดาย (ดูส่วนข้อมูลไบนารีด้านล่าง) คำสั่ง 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 connected RP2040 devices in BOOTSEL mode SYNOPSIS: 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, --basic Include basic information. This is the default -p, --pins Include pin information -d, --device Include device information --debug Include device debug information -l, --build Include build attributes -a, --all Include all information TARGET 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, --force Force 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-reboot Force 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 To target a file <filename> The file name -t <type> Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
โปรดทราบว่าอาร์กิวเมนต์ -f จะแตกต่างกันเล็กน้อยสำหรับแพลตฟอร์ม Windows และ macOS / Unix
เช่น
$ picotool info ชื่อข้อมูลโปรแกรม: คุณสมบัติ hello_world: stdout ถึง UART
$ picotool info -a Program Information name: hello_world features: stdout to UART binary start: 0x10000000 binary end: 0x1000606c Fixed Pin Information 20: UART1 TX 21: UART1 RX Build Information build date: Dec 31 2020 build attributes: Debug build Device Information flash size: 2048K ROM version: 2
$ picotool info -bp ชื่อข้อมูลโปรแกรม: คุณสมบัติ hello_world: stdout ถึง UART
ข้อมูลพินคงที่ 20: UART1 TX 21: UART1 RX
$ picotool info -a lcd_1602_i2c.uf2 File lcd_1602_i2c.uf2: Program Information name: lcd_1602_i2c web site: https://github.com/raspberrypi/pico-examples/tree/HEAD/i2c/lcd_1602_i2c binary start: 0x10000000 binary end: 0x10003c1c Fixed Pin Information 4: I2C0 SDA 5: I2C0 SCL Build Information build date: Dec 31 2020
Config ช่วยให้คุณสามารถกำหนดค่าข้อมูลไบนารีบนอุปกรณ์ได้ หากกำหนดค่าได้ โดยเฉพาะ คุณสามารถกำหนดค่า bi_ptr_int32
และ bi_ptr_string
$ picotool help config
CONFIG:
Display or change program configuration settings from the target device(s) or file.
SYNOPSIS:
picotool config [-s <key> <value>] [-g <group>] [device-selection]
picotool config [-s <key> <value>] [-g <group>] <filename> [-t <type>]
OPTIONS:
<key>
Variable name
<value>
New value
-g <group>
Filter by feature group
TARGET 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, --force
Force 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-reboot
Force 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
To target a file
<filename>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
$ picotool config
n = 5
name = "Billy"
nonconst_pins:
default_pin = 3
default_name = "My First Pin"
$ picotool config -g nonconst_pins
nonconst_pins:
default_pin = 3
default_name = "My First Pin"
$ picotool config -s name Jane
name = "Billy"
setting name -> "Jane"
$ picotool config
n = 5
name = "Jane"
nonconst_pins:
default_pin = 3
default_name = "My First Pin"
load
ช่วยให้คุณสามารถเขียนข้อมูลจากไฟล์ลงในอุปกรณ์ได้ (ไม่ว่าจะเขียนลงแฟลชหรือลง RAM)
$ picotool help load
LOAD:
Load the program / memory range stored in a file onto the device.
SYNOPSIS:
picotool load [--ignore-partitions] [--family <family_id>] [-p <partition>] [-n] [-N] [-u] [-v] [-x] <filename> [-t <type>] [-o
<offset>] [device-selection]
OPTIONS:
Post load actions
--ignore-partitions
When writing flash data, ignore the partition table and write to absolute space
--family
Specify the family ID of the file to load
<family_id>
family id to use for load
-p, --partition
Specify the partition to load into
<partition>
partition to load into
-n, --no-overwrite
When writing flash data, do not overwrite an existing program in flash. If picotool cannot determine the size/presence of the
program in flash, the command fails
-N, --no-overwrite-unsafe
When writing flash data, do not overwrite an existing program in flash. If picotool cannot determine the size/presence of the
program in flash, the load continues anyway
-u, --update
Skip writing flash sectors that already contain identical data
-v, --verify
Verify the data was written correctly
-x, --execute
Attempt to execute the downloaded file as a program after the load
File to load from
<filename>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
BIN file options
-o, --offset
Specify the load address for a BIN file
<offset>
Load offset (memory address; default 0x10000000)
Target device selection
--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, --force
Force 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-reboot
Force 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
เช่น
$ picotool load blink.uf2
Loading into Flash: [==============================] 100%
save
ช่วยให้คุณสามารถบันทึกช่วง RAM โปรแกรมในแฟลช หรือช่วงแฟลชที่ชัดเจนจากอุปกรณ์ไปยังไฟล์ BIN หรือไฟล์ UF2
$ picotool help save
SAVE:
Save the program / memory stored in flash on the device to a file.
SYNOPSIS:
picotool save [-p] [device-selection]
picotool save -a [device-selection]
picotool save -r <from> <to> [device-selection]
OPTIONS:
Selection of data to save
-p, --program
Save the installed program only. This is the default
-a, --all
Save all of flash memory
-r, --range
Save 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 hex
Source device selection
--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, --force
Force 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-reboot
Force 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
เช่น ดูก่อนว่ามีอะไรอยู่ในเครื่อง...
$ 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
seal
อนุญาตให้คุณลงชื่อและ/หรือแฮชไบนารี่เพื่อรันบน RP2350
ตามค่าเริ่มต้น ระบบจะลงนามในไบนารี่ แต่สามารถกำหนดค่าได้ด้วยอาร์กิวเมนต์ --hash
และ --no-sign
รหัสลงนามของคุณต้องเป็นของเส้นโค้ง secp256k1 ในรูปแบบ PEM คุณสามารถสร้างไฟล์ .PEM ด้วย:
openssl ecparam - ชื่อ secp256k1 -genkey - ออก private.pem
$ picotool help seal
SEAL:
Add final metadata to a binary, optionally including a hash and/or signature.
SYNOPSIS:
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>..]]
OPTIONS:
--quiet
Don't print any output
--verbose
Print verbose output
--major <major>
Add Major Version
--minor <minor>
Add Minor Version
--rollback <rollback> [<rows>..]
Add Rollback Version
Configuration
--hash
Hash the file
--sign
Sign the file
--clear
Clear all of SRAM on load
File to load from
<infile>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
BIN file options
-o, --offset
Specify the load address for a BIN file
<offset>
Load offset (memory address; default 0x10000000)
File to save to
<outfile>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
Key file
<key>
The file name
-t <type>
Specify file type (pem) explicitly, ignoring file extension
File to save OTP to (will edit existing file if it exists)
<otp>
The file name
-t <type>
Specify file type (json) explicitly, ignoring file extension
encrypt
ช่วยให้คุณสามารถเข้ารหัสและลงนามไบนารี่เพื่อใช้กับ RP2350 ตามค่าเริ่มต้น มันจะเซ็นชื่อไบนารีที่เข้ารหัส แต่สามารถกำหนดค่าได้คล้ายกับ picotool sign
ไบนารีที่เข้ารหัสจะมีโครงสร้างดังต่อไปนี้:
บล็อกข้อมูลเมตาแรก (5 คำ)
สี่ (4 คำ)
ไบนารีที่เข้ารหัส
การเติมเพื่อให้แน่ใจว่าความยาวที่เข้ารหัสจะเป็นผลคูณของ 4 คำ
บล็อกข้อมูลเมตาลายเซ็น
ต้องระบุคีย์ AES เป็นไฟล์ .bin ของคีย์ AES 256 บิตเพื่อใช้สำหรับการเข้ารหัส
$ picotool help encrypt
ENCRYPT:
Encrypt the program.
SYNOPSIS:
picotool encrypt [--quiet] [--verbose] [--hash] [--sign] <infile> [-t <type>] [-o <offset>] <outfile> [-t <type>] <aes_key> [-t <type>]
[<signing_key>] [-t <type>]
OPTIONS:
--quiet
Don't print any output
--verbose
Print verbose output
Signing Configuration
--hash
Hash the encrypted file
--sign
Sign the encrypted file
File to load from
<infile>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
BIN file options
-o, --offset
Specify the load address for a BIN file
<offset>
Load offset (memory address; default 0x10000000)
File to save to
<outfile>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
AES Key
<aes_key>
The file name
-t <type>
Specify file type (bin) explicitly, ignoring file extension
Signing Key file
<signing_key>
The file name
-t <type>
Specify file type (pem) explicitly, ignoring file extension
คำสั่ง partition
ช่วยให้คุณสามารถโต้ตอบกับตารางพาร์ติชันบนอุปกรณ์ RP2350 และยังสร้างคำสั่งเหล่านั้นด้วย
$ picotool help partition info
PARTITION INFO:
Print the device's partition table.
SYNOPSIS:
picotool partition info -m <family_id> [device-selection]
OPTIONS:
-m <family_id> [device-selection]
$ picotool partition info
un-partitioned_space : S(rw) NSBOOT(rw) NS(rw), uf2 { absolute }
partitions:
0(A) 00002000->00201000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000000, "A", uf2 { rp2350-arm-s, rp2350-riscv }, arm_boot 1, riscv_boot 1
1(B w/ 0) 00201000->00400000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000001, "B", uf2 { rp2350-arm-s, rp2350-riscv }, arm_boot 1, riscv_boot 1
$ picotool partition info -m rp2350-arm-s
un-partitioned_space : S(rw) NSBOOT(rw) NS(rw), uf2 { absolute }
partitions:
0(A) 00002000->00201000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000000, "A", uf2 { rp2350-arm-s, rp2350-riscv }, arm_boot 1, riscv_boot 1
1(B w/ 0) 00201000->00400000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000001, "B", uf2 { rp2350-arm-s, rp2350-riscv }, arm_boot 1, riscv_boot 1
Family id 'rp2350-arm-s' can be downloaded in partition 0:
00002000->00201000
คำสั่งนี้ช่วยให้คุณสร้างตารางพาร์ติชันและฝังเพิ่มเติมลงในบล็อกลูปหากไฟล์ ELF (เช่นสำหรับ bootloaders) ตามค่าเริ่มต้น ตารางพาร์ติชันทั้งหมดจะถูกแฮช และคุณยังสามารถเซ็นชื่อได้
$ picotool help partition create
PARTITION CREATE:
Create a partition table from json
SYNOPSIS:
picotool partition create [--quiet] [--verbose] <infile> [-t <type>] <outfile> [-t <type>] [[-o <offset>] [--family <family_id>]]
[<bootloader>] [-t <type>] [[--sign <keyfile>] [-t <type>] [--no-hash] [--singleton]] [[--abs-block] [<abs_block_loc>]]
OPTIONS:
--quiet
Don't print any output
--verbose
Print verbose output
partition table JSON
<infile>
The file name
-t <type>
Specify file type (json) explicitly, ignoring file extension
output file
<outfile>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
UF2 output options
-o, --offset
Specify the load address for UF2 file output
<offset>
Load offset (memory address; default 0x10000000)
--family
Specify the family if for UF2 file output
<family_id>
family id for UF2 (default absolute)
embed partition table into bootloader ELF
<bootloader>
The file name
-t <type>
Specify file type (elf) explicitly, ignoring file extension
Partition Table Options
--sign <keyfile>
The file name
-t <type>
Specify file type (pem) explicitly, ignoring file extension
--no-hash
Don't hash the partition table
--singleton
Singleton partition table
Errata RP2350-E9 Fix
--abs-block
Enforce support for an absolute block
<abs_block_loc>
absolute block location (default to 0x10ffff00)
คำสั่ง uf2
อนุญาตให้สร้าง UF2 และ cam จะให้ข้อมูลเมื่อการดาวน์โหลด UF2 ล้มเหลว
คำสั่งนี้จะแทนที่ฟังก์ชันการทำงานของ elf2uf2 ที่เคยอยู่ใน Raspberry Pi Pico SDK โดยจะพยายามตรวจจับ family ID โดยอัตโนมัติ แต่หากล้มเหลว คุณสามารถระบุได้ด้วยตนเองด้วยอาร์กิวเมนต์ --family
picotool help uf2 convert
UF2 CONVERT:
Convert ELF/BIN to UF2.
SYNOPSIS:
picotool uf2 convert [--quiet] [--verbose] <infile> [-t <type>] <outfile> [-t <type>] [-o <offset>] [--family <family_id>]
[[--abs-block] [<abs_block_loc>]]
OPTIONS:
--quiet
Don't print any output
--verbose
Print verbose output
File to load from
<infile>
The file name
-t <type>
Specify file type (uf2 | elf | bin) explicitly, ignoring file extension
File to save UF2 to
<outfile>
The file name
-t <type>
Specify file type (uf2) explicitly, ignoring file extension
Packaging Options
-o, --offset
Specify the load address
<offset>
Load offset (memory address; default 0x10000000 for BIN file)
UF2 Family options
<family_id>
family id for UF2
Errata RP2350-E9 Fix
--abs-block
Add an absolute block
<abs_block_loc>
absolute block location (default to 0x10ffff00)
คำสั่งนี้อ่านข้อมูลบนอุปกรณ์เกี่ยวกับสาเหตุที่การดาวน์โหลด UF2 ล้มเหลว มันจะให้ข้อมูลเฉพาะในกรณีที่การดาวน์โหลดครั้งล่าสุดล้มเหลว
$ picotool help uf2 info
UF2 INFO:
Print info about UF2 download.
SYNOPSIS:
picotool uf2 info [device-selection]
OPTIONS:
Target device selection
--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, --force
Force 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-reboot
Force 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
คำสั่ง otp
ใช้สำหรับโต้ตอบกับหน่วยความจำ RP2350 OTP ไม่มีให้บริการในอุปกรณ์ RP2040 เนื่องจาก RP2040 ไม่มี OTP
โปรดทราบว่าหน่วยความจำ OTP สามารถตั้งโปรแกรมได้ครั้งเดียว ซึ่งหมายความว่าเมื่อเปลี่ยนบิตจาก 0 เป็น 1 แล้ว จะไม่สามารถเปลี่ยนกลับได้ ดังนั้น ควรใช้ความระมัดระวังเมื่อใช้คำสั่งเหล่านี้ เนื่องจากอาจเสี่ยงต่อการปิดอุปกรณ์ RP2350 ของคุณ ตัวอย่างเช่น หากคุณตั้งค่า SECURE_BOOT_ENABLE แต่ไม่ได้ตั้งค่าคีย์การบูต และปิดใช้งานอินเทอร์เฟซ PICOBOOT อุปกรณ์ของคุณก็จะใช้งานไม่ได้
สำหรับคำสั่ง list
, set
, get
และ load
คุณสามารถกำหนดโครงร่าง OTP ของคุณเองในไฟล์ JSON และส่งผ่านสิ่งนั้นด้วยอาร์กิวเมนต์ -i
แถวเหล่านี้จะถูกเพิ่มลงในแถวเริ่มต้นเมื่อแยกวิเคราะห์
$ picotool help otp
OTP:
Commands related to the RP2350 OTP (One-Time-Programmable) Memory
SYNOPSIS:
picotool otp list [-p] [-n] [-i <filename>] [<selector>..]
picotool otp get [-c <copies>] [-r] [-e] [-n] [-i <filename>] [device-selection] [-z] [<selector>..]
picotool otp set [-c <copies>] [-r] [-e] [-i <filename>] [-z] <selector> <value> [device-selection]
picotool otp load [-r] [-e] [-s <row>] [-i <filename>] <filename> [-t <type>] [device-selection]
picotool otp dump [-r] [-e] [device-selection]
picotool otp permissions <filename> [-t <type>] [--led <pin>] [--hash] [--sign] [<key>] [-t <type>] [device-selection]
picotool otp white-label -s <row> <filename> [-t <type>] [device-selection]
SUB COMMANDS:
list List matching known registers/fields
get Get the value of one or more OTP registers/fields (RP2350 only)
set Set the value of an OTP row/field (RP2350 only)
load Load the row range stored in a file into OTP and verify. Data is 2 bytes/row for ECC, 4 bytes/row for raw. (RP2350 only)
dump Dump entire OTP (RP2350 only)
permissions Set the OTP access permissions (RP2350 only)
white-label Set the white labelling values in OTP (RP2350 only)
คำสั่งเหล่านี้จะตั้งค่า/รับแถวเฉพาะของ OTP ตามค่าเริ่มต้น พวกเขาจะเขียน/อ่านแถวที่ซ้ำซ้อนทั้งหมด แต่สามารถแทนที่ได้ด้วยอาร์กิวเมนต์ -c
คำสั่งนี้อนุญาตให้โหลดช่วง OTP แถวลงในอุปกรณ์ แหล่งที่มาอาจเป็นไฟล์ไบนารีหรือไฟล์ JSON เช่นเอาต์พุตเดียวโดย picotool sign
ตัวอย่างเช่น หากคุณต้องการลงนามไบนารี่แล้วทดสอบการบูตอย่างปลอดภัย คุณสามารถรันชุดคำสั่งต่อไปนี้:
$ picotool sign hello_world.elf hello_world.signed.elf private.pem otp.json
$ picotool load hello_world.signed.elf
$ picotool otp load otp.json
$ picotool reboot
คำสั่งนี้อนุญาตให้ใช้ OTP white-labeling ซึ่งตั้งค่าการกำหนดค่า USB ที่อุปกรณ์ใช้ในโหมด BOOTSEL ซึ่งสามารถกำหนดค่าได้จากไฟล์ JSON ตัวอย่างที่อยู่ใน Sample-wl.json
<cod