Background Information
The TuyaOS Gateway Development Framework uses xmake
to compile the framework. After downloading the development framework from Tuya Wind IDE, you can directly compile the project for apps. Newly added source files will be compiled and linked, without having to worry about cumbersome Makefile rules. It is very simple and user-friendly to use.
This scenario is suitable for developing applications on the TuyaOS development framework. However, if you already have your own compilation framework or project, migrating the original project to Tuya Wind IDE may not be a good choice. Instead, it may be more reasonable to import the header and library files of the TuyaOS development framework into your project.
By separating the header and library files of the TuyaOS development framework, we call it Standalone
. Since the TuyaOS development framework is a whole and depends on the development environment, there are some precautions for Standalone. This article will discuss in detail how to integrate the Standalone version of the TuyaOS development framework into your project.
Integration Guide
The Standalone TuyaOS development framework includes four parts:
- SDK header files
- SDK library files
- TuyaOS Kernel Layer (TKL) header and source files
- Application source files
Step 1: Download the development package through Tuya Wind IDE, and then extract the above four parts to integrate them into your project.
Step 2: The SDK header files are located in TuyaOS/include, and the library files are located in TuyaOS/libs. Simply import these two directories into your project, add the header file directory and its subdirectories to the header file search path, and link the corresponding library.
Step 3: The application source files are located in TuyaOS/apps. Based on your product needs, use an application project that matches your product needs as a basic template for development. Import the application source files into your project and add the application source code to the compilation list.
Step 4: The TKL header and source files are located in TuyaOS/vendor/<development environment>/tuyaos/tuyaos_adapter. Import the include and src directories under this directory into your project, add the include directory and its subdirectories to the header file search path, and add the source files in the include and src directories to the compilation list.
By following the above steps, you can smoothly integrate the development package into your compilation framework and continue development on your original project.
Precautions
- When linking library files, it is recommended to use the
-Wl,--start-group <link library> -Wl,--end-group
option to avoid the problem of dependency order of multiple static libraries. - The TKL include directory contains some .c source files, which can be found using the
find
command. Do not miss them when compiling.