Generate Library Example
Supported Platforms and Build Environments
Independent of board and which SiFli MCU series is used
The build environment for compiling libraries depends on the build environment configuration used by normal projects
Verified environments include KeilC and GCC
Overview
Some customers, due to confidentiality requirements or other reasons, are unwilling to disclose source code and need to compile lib libraries for customer use, hence this example is provided.
Compilation Method
Set up build environment
The prerequisite for compiling lib is that normal projects can be compiled with KeilC or GCCPlace the source files that need to be generated into lib in the
example\misc\generate_lib\libdirectory. All source files*.c,*.hin this directory will be packaged and compiled into a lib_rvds.lib fileCompile lib
Switch to the exampleexample\misc\generate_lib\projectdirectory and run the scons command to execute compilation:
scons -j16
Where the parameter -j16 is for 16-thread compilation
Compilation process:

Generated lib as follows:

Note
Files compiled into lib are those defined as lib group in the SConscript file. The compilation group is specified in the libname of rtconfig.py. You can modify them synchronously if needed;
Configuration in example\misc\generate_lib\lib\SConscript:
group = DefineGroup('lib', src, depend = [''], CPPPATH = CPPPATH)
Configuration in example\misc\generate_lib\project\rtconfig.py:
libname="lib"
Usage Method
Copy the generated
lib_rvds.libfile to the project directory that needs to be compiled, and modify the SConscript file in the corresponding directory. Here we use theexample\get-started\hello_world\rttexample as an illustration, as shown below:

path = GetCurrentDir()
lib = ['lib_rvds']
group = DefineGroup('lib', src, depend = [''], LIBS = lib, CPPPATH = path, LIBPATH = path)
During compilation, if functions in
lib_rvds.libcan be found, the lib linking is successful
Troubleshooting
Compilation Failure: Ensure source files have no syntax errors and build environment is configured correctly
Linking Errors: Check library file path is correct and function declarations match
Library File Not Generated: Verify
SConscriptandrtconfig.pyconfigurations
For any technical questions, please submit an issue on GitHub