Rust Hardware Abstraction Layer (HAL) for SiFli MCUs.
Warning
This crate is a working-in-progress and not ready for production use.
Github | crates.io | docs.rs | Support Status |
---|---|---|---|
sifli-hal | |||
sifli-pac | |||
sifli-flash-table |
First, install cargo-binutils:
cargo install cargo-binutils
rustup component add llvm-tools
Next, use objcopy
to generate a .bin
file:
cargo objcopy --bin blinky -- -O binary main.bin
Then, compile the blink/no-os project in the SDK and copy the main.bin
file into the build directory (e.g., build_em-lb525_hcpu
), replacing the existing main.bin
file.
Make sure the new firmware size is smaller than the old one; otherwise, you may need to manually modify the ftab
or use sifli-flash-table to generate a new ftab.bin
.
Afterward, use the same programming method as with the SDK (for example, running build_em-lb525_hcpu\uart_download.bat
or programming via JLink).
By utilizing SifliUsartServer , you can generate a J-Link server, which then allows you to connect to it using Cortex-Debug within VS Code.
"configurations": [
{
"cwd": "${workspaceFolder}",
"name": "C Debug",
"request": "attach",
"type": "cortex-debug",
"device": "Cortex-M33",
"runToEntryPoint": "entry",
"showDevDebugOutput": "none",
"servertype": "jlink",
"serverpath": "F:/Dev/Jlink/JLink_V812e/JLinkGDBServerCL.exe",
"ipAddress": "127.0.0.1:19025",
"interface": "swd",
// There's a slight issue with the SVD file format included in the SDK.
// It's necessary to use the SVD files in sifli-pac.
"svdFile": "xxx/sifli-pac/svd/SF32LB52x.svd",
"executable": "examples/sf32lb52x/target/thumbv8m.main-none-eabi/debug/blinky"
},
]
In certain HardFault scenarios, the Cortex-Debug connection may be interrupted. If this occurs, you might need to resort to J-Link Commander or alternative tools for debugging.
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.