Skip to content

Rust Hardware Abstraction Layer (HAL) for SiFli MCUs

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

OpenSiFli/sifli-hal-rs

Repository files navigation

SiFli Rust HAL

Crates.io Support status

Rust Hardware Abstraction Layer (HAL) for SiFli MCUs.

Warning

This crate is a working-in-progress and not ready for production use.

Crates

Github crates.io docs.rs Support Status
sifli-hal Crates.io docs.rs
sifli-pac Crates.io docs.rs
sifli-flash-table

Get Started

Build & Flash

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).

Debug

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.

License

This project is licensed under either of

at your option.

About

Rust Hardware Abstraction Layer (HAL) for SiFli MCUs

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •