Quick Start

Last Updated on : 2024-06-25 03:38:16download

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

Terms

Concept Description
Type development kit A type development kit, a TuyaOS-based development framework, is designed to help you quickly develop IoT products for different use cases and roll them out to the market. A type development kit consists of the build framework, development environment, demo, library, and header file. For more information, see Type Development Kit.
Product development kit A product development kit, based on a particular type development kit, provides the complete source code used to develop products specific to a vertical. For more information, see Product Development.
Development mode TuyaOS provides two development modes:
  • TuyaOS OS development: Develop applications with Tuya’s gateway module (check the supported development platforms), without caring about the board support package (BSP) and TuyaOS adaptation as they are already integrated into the development environment.
  • TuyaOS SDK development: Develop applications, adapt BSP, and port TuyaOS to your proprietary hardware yourself.
For more information, see Development Mode.
Release notes The release notes for the type development kits in the Gateway Development Framework. For more information, see Release Notes.

Development process

In TuyaOS SDK development, if you cannot find the development kit for your platform, contact your account manager and provide the cross compiler toolchain you use. Tuya will upload the development kit accordingly

Quick Start

Get started

Development kit download

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
  6. If you use TuyaOS OS development, you can download the product development kit. Choose Dev Framework > Product Dev Kit and request permission for the kit you need.

    The product development kit is downloaded to software/TuyaOS/apps.

    Quick Start

About the 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.

Cross-platform porting

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.

Porting guides:

Building 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 building

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.