Development Environment

Last Updated on : 2022-03-25 06:21:53download

This topic describes how to set up the development environment for achieving IoT-enabled products through Wi-Fi SDKs for custom development. Before you get started, install Ubuntu on VirtualBox in Windows and install the required build tools on Ubuntu. Then, you are good to go in developing with the SDK.

Download software

  1. Visit the VirtualBox website. Click Windows hosts to download the package.

    Development Environment
  2. Visit the Ubuntu website and download the Ubuntu ISO image. The examples in this topic use Ubuntu 20.04.

    Development Environment

Install VirtualBox

Follow the wizard and finish the setup.

  1. Run the installer. On the welcome setup wizard page, click Next to begin the installation wizard.

    Development Environment

  2. Custom setup

    In most cases, you would not change the features to be installed except for special situations. You can change the location to some other directory if you would like. When you are ready, click Next to continue.

    If you have sufficient free space on C drive, you can leave the default directory as is. If you want to change the directory, click Browse, select the desired directory, and click Next.

    Development Environment

  3. Click Next to continue.

    Development Environment

  4. Click Yes to continue.

    Development Environment

  5. Click Install to begin the installation.

    Development Environment
  6. Finally, click Finish to complete the setup.

    Development Environment

Install virtual machine

Install Ubuntu on VirtualBox

  1. Open VirtualBox, and then click New to create a virtual machine (VM).

    Development Environment
  2. Enter Ubuntu as the name. The examples in this topic use Ubuntu 20.04 so we select Linux as the type and Ubuntu (64-bit) as the version.

    Development Environment

  3. In the Machine Folder option, select a location to install the VM.

  4. Allocate RAM size to your VM.

    A VM with sufficient RAM can offer you better performance. The computer we use has 16 GB RAM. We allocate 4 GB (4096 MB) to the VM. You can change the RAM allocation later when needed.

    Development Environment
  5. Specify the size of the virtual hard disk.

    We allocate 50 GB to the VM. You can select the hard disk size as per your resources and change the disk size later when needed.

    Development Environment Development Environment Development Environment

    Select disk size and the destination folder to install.

    Development Environment
  6. After the disk creation is done, begin installing Ubuntu on the VM. Click Optical Drive. Select the downloaded Ubuntu ISO image and click the Start button.

    Development Environment
  7. Click Install Ubuntu.

    Development Environment Development Environment
  8. Choose Minimal installation and uncheck Download updates while installing Ubuntu to save time after installation.

    Development Environment
  9. Choose Erase disk and install Ubuntu. Click Install Now.

    Development Environment
  10. Click Continue and proceed with writing changes on the disk.

    Development Environment
  11. Choose your current location and click Continue.

    Development Environment
  12. Enter your name and password to configure your system identity.

    The username and password will be used for identity verification in subsequent operations.

    Development Environment
  13. Once the installation process is finished, reboot your VM.

  14. After rebooting, you will be prompted to remove the installation medium and then press ENTER.

  15. When the optical drive is empty, press ENTER and wait for the VM to finish the setup.

    If the ISO image is not removed automatically, you can remove it manually.

    Development Environment
  16. After powering on the VM, enter the password to log in.

Install guest additions

After installing Ubuntu, you need to install the guest additions to get better hardware functionality. These include auto-resize guest display, shared clipboard, and more.

  1. Open the Ubuntu VM. Click Devices > Insert Guest Additions CD Image.

    Development Environment
  2. Click Run.

    Development Environment
  3. When Press Return to close this window... is displayed in the window, press ENTER and reboot the VM.
    The screen resolution of guest can be automatically adjusted with the window size.

    Development Environment

  4. Choose Devices > Shared Clipboard > Bidirectional. The clipboard of the guest OS is shared with that of your host.

    Development Environment

Install the build tool

To use the Wi-Fi SDK, you need to install the required tools for building the firmware.

The examples in this topic use Samba to share files across different operating systems over a network. Samba runs on Linux-based platforms but is able to communicate with Windows clients like a native application. It allows you to edit the project in Windows and build the project in Linux.

It is not recommended to use the shared folders feature of VirtualBox because Linux’s file system is different from the Windows’s file system. When you copy the SDK on GitHub to the shared folder in VirtualBox for building, errors might occur.

Set the download server

Before software installation, you can change the download server to have the best download speed.

  1. Open Software & Updates.

    Development Environment
  2. Under the Ubuntu Software tab, choose Other... in the Download from the drop-down box.

    Development Environment

  3. Choose Select Best Server option to let Ubuntu find a mirror that gives you the best download speed for your location.

    Development Environment

  4. Once the best mirror is found, click Choose server option.

    Development Environment

  5. Close the Software & Updates window. Click Reload to update the repository lists.

    Development Environment

    Development Environment

  6. After reloading, the updated source list can best suit your location.

Download the dependency

Open the Ubuntu VM. Right-click on the desktop and choose Open Terminal from the menu.

After entering the command, you will be asked to enter the password.

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install net-tools build-essential wget git python libc6-i386

All the required tools are ready. You can start building your project.

Install Samba

Samba enables you to share files between Ubuntu and Windows.


Before installing Samba, you need to configure the network first.

  1. Power off the VM.

  2. Choose Settings > Network > Adapter 2.

  3. Under the Adapter 2 tab, select Enable Network Adapter. Under the Attached to label, select Host-only Adapter from the drop-down box.

  4. Click OK to complete the setup.

    Development Environment

Installation process

  1. Open the VM and run the following command:

  2. After ifconfig is run, you will get the IP address of your computer.

    Development Environment

  3. Run the following command to install Samba:

    sudo apt-get update
    sudo apt-get install samba cifs-utils samba-common
  4. After Samba is installed, create a shared directory for file sharing between Ubuntu and Windows and set read, write, and execute permissions for this directory. Run the following commands in turn.

    sudo mkdir -p /home/share/samba
    sudo chmod 777 -R /home/share/samba
  5. Run the following command and edit the Samba configuration:

    sudo gedit /etc/samba/smb.conf
  6. Add the following code at the end-of-file. Save and exit.

    path = /home/share/samba
    available = yes
    browseable = yes
    public = no
    writable = yes
    Development Environment
  7. Enter the following command to add a specified user to the Samba user group and set the Samba password.

    sudo smbpasswd -a xxxx #(Replace xxxx with your username)
  8. Run the following command to reboot Samba:

    sudo service smbd restart
  9. Navigate to your Windows desktop. Click This PC, choose Add a network location, and enter the IP address of your Ubuntu VM in the Internet or network address box.

    If you forget the IP address, you can run ifconfig in your Ubuntu VM and find it.

    Development Environment

    Development Environment
  10. Enter your username and password.

    You can select Remember my credentials for convenience.

    Development Environment

The Samba setup is done.

Build and verify

To verify the VM setup, you can download the SDK and use it to build your project.

To get the SDK, you can download it from GitHub or from the Tuya IoT Development Platform. Either of these two methods can support your verification.

Get SDK from GitHub

The example uses the SDK for BK7231N to demonstrate the process.

  1. Open the Ubuntu VM. Run the following command to get the SDK for BK7231N:

    cd /home/share/samba/
    git clone
  2. Run the following command to start building tuya_demo_template:

    cd tuya-iotos-embeded-sdk-wifi-ble-bk7231n/
    sh apps/tuya_demo_template/ tuya_demo_template 1.0.0 # This command is described later.
  3. If your output window looks like the following, it indicates the build is successful.

    Development Environment

Get SDK from platform

  1. Create a product on the Tuya IoT Development Platform. Under the Hardware Development tab, choose TuyaOS and select a module. You can then download the SDK in the Download Documents area.

    For more information, see Hardware Development.

    Development Environment

  2. Copy the downloaded SDK to the shared folder and run the following command in Ubuntu VM to build your project.

    cd /home/share/samba/
    tar -xzvf *.tar.gz # Note that this command will extract all the `tar.gz` files. You can change the name of these files to the desired name.
    cd ty_iot_sdk_bk7231n_2.3.1
    sh apps/tuya_demo_template/ tuya_demo_template 1.0.0 # Run this command to start building automatically after the required resources are downloaded.