Project Setup

The SiFli SDK uses the menuconfig tool to configure user applications and SDK options. Menuconfig uses the same syntax as the Linux kernel configuration, generating project-related .config and rtconfig.h files, which can be applied to build scripts and C code. For information on the syntax of Menuconfig, you can refer to https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html.

Starting menuconfig:

To start menuconfig in the user project directory (which usually contains the Sconscruct file), set up the SDK environment and then run menuconfig. The menuconfig interface will appear.

Modifying Configuration

Change the configuration values in the menu configuration interface as follows:

  • Use the arrow keys to browse the menu. Vim-style key bindings are also supported.

  • Use the spacebar and Enter key to enter menus and toggle values. A --> will appear next to the menu. Press ESC to return to the parent menu.
    Boolean configuration options are enclosed in square brackets [], while numeric and string configuration values are enclosed in parentheses (). Unmodifiable values are shown as – or -*- .
    You can also press Y or N to set Boolean values.

  • Press ? to display information about the currently selected symbol, including its help text. Press ESC or Q to return to the menu after viewing the help.

  • Press Q in the menuconfig interface to open the “Save and Exit” dialog (if there are changes to save):


Press Y to save the kernel configuration options with the default file name (.config). Unless using a different configuration, it will typically be saved with the default file name.

Note

The configuration file used during the build is always _.config_. If you want to use another saved configuration, copy it to .config. Make sure to back up the original configuration file. <br> 


If you jump to a symbol that is currently invisible (for example, due to unsatisfied dependencies), “Show All” mode will be enabled. In “Show All” mode, all symbols, including currently invisible ones, will be displayed. To turn off “Show All” mode, press ESC in menuconfig.

  • If no items are visible in the current menu, “Show All” mode cannot be turned off.
    To find out why the symbol you jumped to is not visible, press to check its dependencies. If it is found to depend on another disabled symbol, you can navigate to that symbol and check if it can be enabled.

  • In menuconfig, you can press ‘F’ to view the help for the current selection without exiting the dialog.

Setting Kconfig Configuration Values

The menuconfig interface can be used to configure tests during application development. This section describes how to make the settings permanent.
A generated list of all Kconfig options can be found in the Kconfig symbol reference.

Note

It is recommended to review the Kconfig tips and best practices page before making changes to Kconfig files.

Kconfig Configuration Items

When making Kconfig changes, it is important to understand the difference between visible and invisible configuration items. Visible symbols are those defined with prompts. These visible symbols appear in the interactive configuration interface and can be set in the configuration file.

Here is an example of a visible configuration:

This configuration item will appear in menuconfig and can be toggled:
Invisible configuration items do not have a prompt. Invisible configuration items are not displayed in the interactive configuration interface, and the user cannot directly control their value. Instead, they get their values from default values or other configuration items.

In this case, the symbol BF0_HCPU is enabled by selecting other symbols that depend on it.

Setting Configuration Items Through the Configuration File

Visible configuration items can be configured by setting them in the configuration file. The initial configuration is generated by merging the board’s .config file with the application settings. For more details, refer to the section on initial configuration.
The assignments in the configuration file use the following syntax:
CONFIG=<value>

Note

No spaces allowed around the equals sign.

Boolean symbols can be enabled or disabled by setting them to y or n. For example, to enable the FPU symbol:

CONFIG_FPU=y

Note

  1. Boolean symbols can also be set to n, and their comment format is as follows:
    #CONFIG_SOME_OTHER_BOOL is not set

  2. This format is seen in the merged configuration in .config.

Assignments for other symbol types are as follows:

  • CONFIG_SOME_STRING="cool value"

  • CONFIG_SOME_INT=123

Commenting with #

#This is a comment

SiFli SDK Configuration

The SDK includes a variety of options that users can configure, including chip, board, drivers, RTOS, peripheral circuits, middleware, third-party software, etc. Users can customize their chosen features as needed.
Users can add SDK configurations to their own project’s Kconfig.
Add the following to your KConfig to include SDK configuration:

config SIFLI_SDK
    string 
    option env="SIFLI_SDK"
    default "."

# SDK configuration  
source "$SIFLI_SDK/Kconfig"

This will introduce the SDK configuration, and after running menuconfig, you will see the following separator:

------------End of SDK configuration -----------  

The SDK configuration mainly consists of the following sections:

  • Chip Selection (Select chipset)
    Select the chip; currently, SF32LB55X should be chosen.

  • Operating System Selection (RTOS)
    RT-Thread is the primary supported operating system and is recommended. It also includes RT-Thread driver configurations for internal IPs of the chip.

  • Board-Level Peripherals (Select board peripherals)
    This section provides configuration for external devices supported by Sifli Technology.

  • Middleware (Sifli middleware)
    This section contains middleware configurations developed by Sifli Technology.

  • Third-Party Software (Third-party package)
    This section includes third-party software verified and optimized by Sifli Technology.

Users can also customize some Kconfig configurations and are advised not to mix them with SDK configurations. It is recommended to use separate Kconfig files.