TuyaOSPort TuyaOS

Port TuyaOS

Last Updated on : 2023-08-11 07:07:51download

Adapt the APIs that TuyaOS depends on to make TuyaOS run properly across multiple hardware platforms. This topic describes how to adapt the minimum set of APIs to run TuyaOS on your chip platform.


Get development framework

  1. To port TuyaOS to a third-party platform, first request permission to download the required TuyaOS development framework. For more information, see Platform Porting Overview (this post is written in Chinese).

  2. After your request is approved, download the development framework from Tuya Wind IDE. A development framework includes TuyaOS header files, libraries, and sample code.

  3. After the development framework is downloaded, perform a compilation to get the TuyaOS kernel adaptation template. For more information about compilation, see Tuya Wind IDE.

    During compilation, Tuya Wind IDE downloads the adaptation template. You will get logs looking like this.

    =========Start: TuyaOS kernel is downloading. Wait five minutes=========
    --2023-06-15 10:11:46-- https://airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com/smart/embed/pruduct/gcc-sigmastar-9-1-0-2020-07-x86_64_arm-linux-gnueabihf_0.0.2.zip
    Resolving airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com (airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com)...,,, ...
    Connecting to airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com (airtake-public-data-1254153901.cos.ap-shanghai.myqcloud.com)||:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 2523458755 (2.3G) [application/zip]
    Saving to: 'gcc-sigmastar-9-1-0-2020-07-x86_64_arm-linux-gnueabihf_0.0.2.zip'
    -linux-gnueabihf_0.0.2.zip               1%[>                                                                            ] 41.75M 3.81MB/s    eta 11m 26s
  4. The development framework will finally create a directory software/TuyaOS/vendor that stores the adaptation template.

    |---software/TuyaOS/vendor                              # TuyaOS kernel.
       |---gcc-sigmastar-9-1-0-2020-07-x86_64_arm-linux-gnueabihf   # A chip vendor-specific SDK.
           |---toolchain                                    # Toolchain used to port TuyaOS to a third-party platform.
           |---tuyaos                                       # TuyaOS kernel adapter, including scripts and source code.
               |---build_path                               # Prefix of the toolchain used to port TuyaOS to a third-party platform.
               |---platform.mk                              # Compilation options for porting TuyaOS to a third-party platform.
               |---tuyaos_adapter                           # TuyaOS kernel adaptation template. It can generate files and functions as per features.
                   |---local.mk                             # Description of TuyaOS adapter compilation.
               |---build.sh                                 # Entry point to TuyaOS firmware compilation. Note: It is called when producing the final firmware/executable file.
               |---makefile                                 # Directly compile the code into an executable. This file is for Linux only, not for RTOS.
               |---tuyaos_kernel.config                     # TuyaOS kernel configuration, such as non-peripheral features.

Prepare hardware

Prepare a development board compatible with the target platform to debug code.

Start porting

Refer to the documentation below for instructions on how to port TuyaOS to your desired platforms.