Examples¶
Start from examples. SF32 firmware usually comes together faster when you adapt a working board-specific example instead of building every subsystem from scratch.
The best example is not always the smallest example. Choose the one that already includes the hardest part of your product: Bluetooth profile, display panel, audio route, filesystem, OTA, USB, power mode, or AI accelerator.
Example Areas¶
| Area | Start with |
|---|---|
| First run | example/get-started/hello_world/rtt/project |
| Blink / GPIO | example/get-started/blink/rtt or GPIO HAL/device examples. |
| Bluetooth | BLE, BT Classic, LE Audio, throughput, beacon, OTA, and profile examples. |
| Graphics | LVGL demos and display-specific examples. |
| Audio | Playback, record, codec, Opus, MP3, and USB audio where supported. |
| Power | SDK power-management examples and measurement templates. |
| Storage | Filesystem, flash, SD, and partition examples. |
| USB | CherryUSB device and host examples. |
| AI | NNACC HAL and RT-device examples. |
Representative SDK Starting Points¶
Use this table after choosing the relevant area. Paths are representative and can change between SDK releases; verify the selected SDK, target board, and configuration before building.
| Development Goal | Representative SDK Starting Point | What to Prove First | Continue With |
|---|---|---|---|
| GPIO output or input | example/hal/gpio, example/rt_device/gpio |
Correct pin mux, polarity, and interrupt behavior on the actual board. | Beginner Tutorials |
| Console and system inspection | example/system/finsh |
Serial console, logs, and basic runtime inspection. | Beginner Tutorials |
| ADC, PWM, or RTC | example/hal/adc, example/rt_device/pwm, example/rt_device/rtc |
Board-specific pin, clock, and peripheral configuration. | Beginner Tutorials |
| I2C sensor | example/hal/i2c/master, example/rt_device/i2c/eeprom |
Electrical connection, bus addressing, and reliable repeated transfers. | Intermediate Tutorials |
| LVGL and local display | example/multimedia/lvgl/lvgl_v8_examples |
Panel initialization, pixel format, and a stable flush path before complex screens. | Graphics Overview, Display Controller |
| BLE peripheral service | example/ble/peripheral, example/ble/hrpc |
Advertising, connection, one GATT characteristic, and reconnect behavior. | Bluetooth Overview |
| Local audio playback | example/multimedia/audio/local_music, mp3_sd_player |
Codec/board path, buffer stability, and cleanup after playback. | Audio Overview |
| Flash-backed storage | example/storage/littlefs/nor, example/storage/flashdb |
Mount, read/write behavior, and recovery from reset or full storage. | Intermediate Tutorials |
| Low-power behavior | example/pm/classical, example/pm/raise_wrist |
Measured current in named states and correct wake-source behavior. | Low-Power Overview |
| BLE OTA | example/ble/peripheral_with_ota |
Interrupted-update recovery and rollback on target hardware. | Advanced Tutorials |
| Runtime diagnosis | example/system/cpu_usage_profiler, example/system/coredump |
Reproducible CPU trace or crash capture before optimizing. | Advanced Tutorials |
How to Choose an Example¶
Use this order:
- Match the board.
- Match the framework.
- Match the hardest peripheral.
- Match the middleware.
- Match the power or memory constraints.
For example, a Bluetooth audio product should start closer to an audio/Bluetooth example than to a clean hello_world, even if the latter is easier to understand.
Adaptation Workflow¶
- Build and flash the unmodified example.
- Save the successful build command, board name, flash command, serial port, and log.
- Make one product change.
- Rebuild and retest.
- Commit or record the change before adding another subsystem.
This workflow is slower for the first hour and much faster after the first hard failure.
Evidence to Keep¶
For each example that becomes a product base, record:
- SDK branch or package version.
- Board name or FQBN.
- Required configuration options.
- Required pins and peripherals.
- Expected serial output.
- Known limitations.
- Memory footprint if available.
- Recovery command.
Example Selection Rule¶
Choose the example that matches the most constrained part of the product:
- For Bluetooth products, start from the closest profile.
- For display products, start from the display and LVGL path.
- For battery products, start from a power example.
- For OTA products, start from the update flow and partition layout.
Then add the other subsystems one by one.
Suggested Learning Path¶
If you are new to the SDK, begin with Beginner Tutorials, then move to Intermediate Tutorials when a single peripheral is stable. Use Advanced Tutorials for measured power work, OTA, custom display bring-up, failure analysis, multi-connection Bluetooth, and custom drivers. The topic overviews explain the architecture and trade-offs behind those examples.
SiFli Team Should Add¶
- A searchable example index.
- Example status by chip/board.
- Expected output for each example.
- Memory and peripheral requirements.
- Links from examples to relevant tools and firmware topics.
- A "recommended base example" table by product type.
Auto-generated content
This page was compiled/drafted without an existing source document. Verify technical claims against SiFli's official documentation before relying on them.