sftool-0.1.9 is not a library.
sftool
A command-line utility for SiFli SoC serial communication tool.
Overview
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.
Features
- Multi-chip Support: SF32LB52, SF32LB56, SF32LB58
- Multiple Storage Types: NOR flash, NAND flash, and SD card
- Configurable Serial Parameters: Customizable baud rates and port settings
- Reliable Flash Operations: Write with verification and compression support
- Flexible Reset Options: Configurable before/after operations
- Cross-platform: Works on Linux, macOS, and Windows
Installation
Install from Crates.io
Install from Git
Build from Source
# Clone the repository
# Build with Cargo
# The compiled binary will be located at
# ./target/release/sftool
Usage
Basic Command Format
Global 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
Write Flash Command
# Linux/Mac
# Windows
Write Flash Options
--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 information
Read Flash Command
Erase Flash Command
Examples
Linux/Mac Examples
# Write single file to flash
# Write multiple files to different addresses
# Write and verify
# Erase all flash before writing
# Read flash memory
# Erase flash region
Windows Examples
# Write multiple files to different addresses
# Other operations are similar to Linux/Mac
Supported File Formats
- Binary files (
.bin
): Raw binary data - Intel HEX files (
.hex
): Intel HEX format - ELF files: Executable and Linkable Format (address information extracted automatically)
Troubleshooting
Common Issues
- Connection timeouts: Try enabling compatibility mode with
--compat
- Permission denied on Linux/Mac: Add your user to the dialout group or use sudo
- Port not found: Check if the device is properly connected and the port path is correct
- Checksum failures: Enable compatibility mode and try lower baud rates
Getting Help
# Show general help
# Show help for specific command
Library Usage
This tool is built on top of the sftool-lib
Rust library. You can integrate the library into your own Rust projects:
[]
= "0.1.7"
See the sftool-lib documentation for API details.
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit issues and Pull Requests.