Quick Start

Last Updated on : 2024-06-25 03:37:22download

This topic walks you through the concepts and development process of the TuyaOS Central Control Development Framework.

Terms

Concept Description
Central Control Device Development Kit Central Control Device Development Kit, built on top of the TuyaOS architecture, is designed to help you quickly develop central control products for different use cases. It consists of the build framework, development environment, demo, library, and header file. For more information, see Central Control Device Development Kit.
Development mode TuyaOS Central Control Development Framework supports two development modes:
  • TuyaOS SDK development: Develop applications, adapt BSP, and port TuyaOS to your proprietary hardware yourself.
  • TuyaOS OS development: Develop applications with Tuya’s module, without caring about the board support package (BSP) and TuyaOS adaptation as they are already integrated into the development environment.
For more information, see Development Mode.
Release notes The release notes for the type development kits in the Central Control Development Framework. For more information, see Release Notes.

Get started

Get development kit

This section describes how to download the development kit from Tuya Wind IDE.

  1. See Tuya Wind IDE and proceed with the installation.

  2. Log in to Tuya Wind IDE using your account of the Tuya Developer Platform.

  3. Click Resource Center and search for the development kit you need. Select a Development Mode and Type Development Kit to show the supported chip platforms.

    In TuyaOS SDK development, if you cannot find the platform you need, contact your account manager and provide the cross compiler toolchain you use.

    Quick Start
  4. Select a platform and click Search to show all the available TuyaOS versions. Find the latest version and click Request Permission.

    Quick Start
  5. Wait for your request to be processed. After it is approved, you can click Create Framework on the home page to download the development kit.

    Quick Start

Directory

The directory of software/TuyaOS:

Name Description
apps The example app, that is the product development kit.
build The build configuration files (leave it as is).
build_app.sh The build script.
docs The API documentation produced by Doxygen.
include The header files.
libs The libraries.
Makefile The Makefile.
output The build output. The generated program is located in output/<project name>_<version number>.
scripts The build framework (leave it as is).
vendor The development environment. It is downloaded to the local computer when you execute the build command.

Port across platforms

Designed with a cross-platform approach, TuyaOS abstracts away the differences between hardware and systems by providing the TuyaOS Kernel API (TKL). When you port TuyaOS, you only need to adapt TKL.

  • TKL API definition: software/TuyaOS/vendor/<development environment>/tuyaos/tuyaos_adapter/include

  • TKL API examples: software/TuyaOS/vendor/<development environment>/tuyaos/tuyaos_adapter/src

    You need to adapt and port TKL when using TuyaOS SDK development, but it is not necessary for TuyaOS OS development.

The standard Linux APIs, such as for the OS, file system, and network, come with examples of TKL implementations.

Most APIs can be used directly, but a few might not be fully compatible with all products, hardware, or chips. In such cases, you need to adapt them accordingly. For more information about porting, see Pair Over Wired Connection.

Build a project

TuyaOS provides a unified build framework, allowing you to write application code and build projects in Tuya Wind IDE.

  • If you use TuyaOS OS development, it is recommended to do custom development on top of the product development kit.
  • If you use TuyaOS SDK development, it is recommended to develop your application on top of the sample project.

How to build a project in Tuya Wind IDE:

  1. Right-click the name of the target project in the apps directory and choose Build Project from the menu.

    Quick Start
  2. Enter the version number in the format X.X.X (where X is a number) and press Enter.

    Quick Start

Integrated build

It is strongly recommended to use Tuya Wind IDE to develop and build a project. However, if you have an existing build framework, you can integrate the development kit into your framework as a component.

This section describes the key steps to integrate the TuyaOS development kit into your existing build framework.

  1. Copy the TuyaOS lib and include directories to your build framework, and write a build rule to specify the include path. Write the link rule to specify the lib path and link the respective library.

    When linking a library, it is recommended to add the option -Wl,--start-group <link library> -Wl,--end-group. This enables you not to take care of the order of dependency when multiple static libraries are used.

  2. Copy the software/TuyaOS/vendor/<development environment>/tuyaos/tuyaos_adapter directory to your build framework, and write a build rule to specify the tuyaos_adapter/include path. Build all the .c files in the tuyaos_adapter/include and tuyaos_adapter/src directories.

  3. Copy the directory of the sample app to your build framework and build all the .c files in this directory.

This way, the development kit can be integrated into your build framework.