Skip to content

Build, Flash, Monitor

This page summarizes the daily SiFli-SDK loop: activate the environment, build with scons, flash the board, and watch logs.

Activate the SDK

Install the SDK environment using the official installation guide for your SDK version. Before building, activate it in each new terminal by running the export script from the SDK root:

cd ~/OpenSiFli/SiFli-SDK
. ./export.sh
cd C:\OpenSiFli\SiFli-SDK
.\export.ps1

The export script loads the environment associated with the current SDK checkout into that terminal. Installation and environment-management steps can vary by SDK version; follow the matching official setup guide.

Build

From an example project directory:

scons --board=<board_name> -j8

Set -j to suit your host machine. If the board name does not specify a core, the SDK selects HCPU by default. For example, sf32lb52-lcd_n16r8 produces build_sf32lb52-lcd_n16r8_hcpu/. Use the directory reported for the resolved board/core target; do not append _hcpu again if the board identifier already specifies a core.

Clean Rebuilds

Use a clean rebuild when switching boards, changing major configuration, or investigating a suspicious build artifact. From the example project directory, run the documented SCons clean option:

scons -c

This cleans build targets and generated temporary/object files; rebuild with the intended board configuration afterward.

Flash

For example, for the sf32lb52-lcd_n16r8 HCPU target, use the UART download script produced by the build:

./build_sf32lb52-lcd_n16r8_hcpu/uart_download.sh
build_sf32lb52-lcd_n16r8_hcpu\uart_download.bat

OpenSiFli also publishes sftool, an open-source command-line utility for communicating with SiFli SoCs over a serial interface. Its documented operations include writing, reading, and erasing flash, as well as controlling chip reset. Check the tool's README for supported chips, storage types, and command options.

Monitor

Use the serial terminal configured for the board and example. The serial log should show boot output, RT-Thread startup messages, application prints, or a shell prompt.

Keep a note of:

  • Board name.
  • Serial port.
  • Baud rate.
  • Build command.
  • Flash command.
  • SDK branch or release.

Daily Developer Loop

Table: Daily Developer Loop
Step Goal
Activate Load the SDK environment into the current terminal.
Configure Select board and feature options.
Build Produce board-specific binaries.
Flash Put the image on hardware.
Monitor Confirm boot and application behavior.
Record Save command/log details for repeatability.

Start from a Matching Example

Before creating or heavily modifying a project, choose the closest SDK example that matches the board and critical subsystem. Build, flash, and monitor that unmodified baseline first; then keep its board name, SDK release, commands, and expected output with the adapted project.

If you use CodeKit, preserve the same evidence and confirm that its editor actions can be reproduced through the SDK command flow.

Troubleshooting

Table: Troubleshooting
Symptom Check
Build tool not found Re-run export.sh / export.ps1 in the current terminal.
Board name unknown Check the SDK supported-boards documentation.
Download script cannot open port Close serial terminals and verify the USB-to-UART cable/connector.
Flash does not start Follow the board's documented download sequence. For sf32lb52-lcd_n16r8, after selecting the serial port, restart the board and press Enter within 2 seconds to start the download; use the target-specific sequence for other boards. Check board power and the selected port/UART connection.
Serial output is unreadable Check baud rate and use the data UART, not a charge-only cable.

Handoff Checklist

Before handing a project to another developer, include:

  • SDK branch or commit.
  • Board name.
  • Setup/install notes.
  • Build command.
  • Flash command.
  • Monitor settings.
  • Expected first log lines.
  • Recovery command.

Last updated: