Crates.io | sftool |
lib.rs | sftool |
version | 0.1.14 |
created_at | 2025-03-06 08:16:09.043768+00 |
updated_at | 2025-09-25 05:58:38.343059+00 |
description | SiFli SoC serial utility command-line tool |
homepage | |
repository | https://github.com/OpenSiFli/sftool |
max_upload_size | |
id | 1580686 |
size | 115,088 |
A command-line utility for SiFli SoC serial communication tool.
SFTool is an open-source command-line utility specifically designed for SiFli series SoCs (System on Chip). It enables communication with chips through serial interfaces, supporting various operations including writing data to flash memory, resetting chips, and more.
cargo install sftool
cargo install --git https://github.com/OpenSiFli/sftool sftool
# Clone the repository
git clone https://github.com/OpenSiFli/sftool.git
cd sftool
# Build with Cargo
cargo build --release
# The compiled binary will be located at
# ./target/release/sftool
sftool [OPTIONS] COMMAND [COMMAND_OPTIONS]
-c, --chip <CHIP>
: Target chip type (currently supports SF32LB52, SF32LB56, SF32LB58)-m, --memory <MEMORY>
: Memory type [nor, nand, sd] (default: nor)-p, --port <PORT>
: Serial port device path-b, --baud <BAUD>
: Baud rate for flash/read operations (default: 1000000)--before <OPERATION>
: Operation before connecting to chip [no_reset, soft_reset] (default: no_reset)--after <OPERATION>
: Operation after tool completion [no_reset, soft_reset] (default: soft_reset)--connect-attempts <ATTEMPTS>
: Number of connection attempts, negative or 0 for infinite (default: 7)--compat
: Compatibility mode, enable if you frequently encounter timeout errors or checksum failures# Linux/Mac
sftool -c SF32LB52 -p /dev/ttyUSB0 write_flash [OPTIONS] <file@address>...
# Windows
sftool -c SF32LB52 -p COM9 write_flash [OPTIONS] <file@address>...
--verify
: Verify flash data after writing-u, --no-compress
: Disable data compression during transfer-e, --erase-all
: Erase all flash regions before programming (not just write regions)<file@address>
: Binary file and its target address. The @address part is optional if the file format contains address informationsftool -c SF32LB52 -p /dev/ttyUSB0 read_flash <address> <size> <output_file>
sftool -c SF32LB52 -p /dev/ttyUSB0 erase_flash <address> <size>
# Write single file to flash
sftool -c SF32LB52 -p /dev/ttyUSB0 write_flash app.bin@0x12020000
# Write multiple files to different addresses
sftool -c SF32LB52 -p /dev/ttyUSB0 write_flash bootloader.bin@0x12010000 app.bin@0x12020000 ftab.bin@0x12000000
# Write and verify
sftool -c SF32LB52 -p /dev/ttyUSB0 write_flash --verify app.bin@0x12020000
# Erase all flash before writing
sftool -c SF32LB52 -p /dev/ttyUSB0 write_flash -e app.bin@0x12020000
# Read flash memory
sftool -c SF32LB52 -p /dev/ttyUSB0 read_flash 0x12020000 0x100000 firmware_backup.bin
# Erase flash region
sftool -c SF32LB52 -p /dev/ttyUSB0 erase_flash 0x12020000 0x100000
# Write multiple files to different addresses
sftool -c SF32LB52 -p COM9 write_flash bootloader.bin@0x12010000 app.bin@0x12020000 ftab.bin@0x12000000
# Other operations are similar to Linux/Mac
.bin
): Raw binary data.hex
): Intel HEX format--compat
# Show general help
sftool --help
# Show help for specific command
sftool write_flash --help
This tool is built on top of the sftool-lib
Rust library. You can integrate the library into your own Rust projects:
[dependencies]
sftool-lib = "0.1.7"
See the sftool-lib documentation for API details.
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit issues and Pull Requests.