This topic describes how to set up a development environment and compile firmware for different versions of the software development kit (SDK).
Prepare the development environment
- Set up the development environment for the SDK.
Set up the development environment for the device-side SDK on a 64-bit Ubuntu system. You can use Vim to edit your code. For instructions, see the relevant online documentation.
Note Compiling the IoT Platform SDK is not supported on Windows systems, including the Windows Subsystem for Linux. - Install the runtime libraries for Ubuntu 16.04 (64-bit).
Run the following commands in order.
sudo apt-get update sudo apt-get -y install libssl-dev:i386 sudo apt-get -y install libncurses-dev:i386 sudo apt-get -y install libreadline-dev:i386 - Install the dependency packages for Ubuntu 16.04 (64-bit).
Run the following commands in order.
sudo apt-get update sudo apt-get -y install git wget make flex bison gperf unzip sudo apt-get -y install gcc-multilib sudo apt-get -y install libssl-dev sudo apt-get -y install libncurses-dev sudo apt-get -y install libreadline-dev sudo apt-get -y install python python-pip - Install the Python dependency packages.
Execute the commands sequentially.
python -m pip install setuptools python -m pip install wheel python -m pip install aos-cube python -m pip install esptool python -m pip install pyserial python -m pip install sconsNote After the installation is complete, run the aos-cube --version command to check the version number of aos-cube. The version number must be 0.5.11 or later.If you encounter network issues during installation, you can use a mirror from the Chinese mainland.
### Install or upgrade pip python -m pip install --trusted-host=mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ --upgrade pip ### Install third-party packages and aos-cube using pip pip install --trusted-host=mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ setuptools pip install --trusted-host=mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ wheel pip install --trusted-host=mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ aos-cube
Compile the SDK with AliOS Things (V1.3.0 and later)
If you are developing device firmware using an SDK with AliOS Things V1.3.0 or later, follow these steps to compile the SDK.
- In your development environment, decompress the downloaded SDK package.If you downloaded the SDK using Git, skip this step.
- Place your application code in the corresponding directory of the SDK.
If you are using an SDK version later than V1.3.0, you can store your code in the Products/Category/ApplicationName/... directory. For example, Products/example/smart_outlet is the reference implementation for a single-channel smart outlet.
The directory structure for SDK V1.3.0 and later is shown below.
ali-smartliving-device-alios-things ├── build.sh ├── LICENSE ├── Living_SDK │ ├── 3rdparty │ ├── app │ ├── board │ ├── build │ ├── device │ ├── doc │ ├── example │ ├── framework │ ├── gen_firmware.sh -> example/smart_led_strip/gen_firmware.sh │ ├── include │ ├── kernel │ ├── LICENSE │ ├── NOTICE │ ├── platform │ ├── projects │ ├── README.md │ ├── security │ ├── site_scons │ ├── test │ ├── tools │ ├── ucube.py │ └── utility ├── Products │ ├── example │ ├── Smart_lighting │ └── Smart_outlet ├── README.md ├── Service │ └── version └── tools ├── 5981a.sh ├── amebaz_dev ├── amebaz_dev.sh ├── asr5501 ├── asr5501.sh ├── bk7231u ├── bk7231udevkitc.sh ├── cmd ├── mk3060.sh ├── mk3080.sh ├── moc108 ├── mx1270.sh ├── rda5981 ├── rtl8710bn └── scripts - Compile the SDK.
- In the SDK root directory, run the
vim build.shcommand to open the build.sh file. - Modify the following parameters in the file based on your hardware module and the application that you want to compile.
default_type="example" //Configure the product type default_app="smart_outlet" //Configure the name of the application to compile default_board="uno-91h" //Configure the module model for compilation default_region=SINGAPORE //Configure the region where the device connects to the cloud: //For V1.5.0 and earlier: For devices activated in the Chinese mainland, set this parameter to MAINLAND. For devices activated in other regions, set this parameter to SINGAPORE. //For V1.6.0 and later: You can set this parameter to MAINLAND or SINGAPORE. Devices can be activated globally. default_env=ONLINE //Configure the cloud connection environment Debug log: default_debug=0 default_args="" //Configure other compilation parameters //For more information, see README.md. - Run the ./build.sh command.
For example, after you compile the smart_outlet application based on the uno-91h module, the smart_outlet@uno-91h_all.bin file is generated in the out\smart_outlet@uno-91h directory. This file is the firmware that you need to flash to the physical device.
Note The build.sh script automatically checks whether the toolchain (cross-compilation toolchain) for the specified module is installed. If the toolchain is not installed, the script automatically installs it.If errors such as missing header files or static libraries occur when you compile this SDK version, see the FAQ.
- In the SDK root directory, run the
Compile the SDK with AliOS Things (V1.1.0 and earlier)
If you are developing device firmware using an SDK with AliOS Things V1.1.0 or V1.0.0 (formerly the Tmall Genie Wi-Fi SDK), follow these steps to compile the SDK.
- In your development environment, decompress the downloaded SDK package.If you downloaded the SDK using Git, skip this step.
- Place your application code in the corresponding directory of the SDK.
You can store your code in the example/ApplicationName directory. For example, if you are developing based on linkkitapp, you can merge your new code into the example/linkkitapp directory.
The following compares the folder structure of SDK versions earlier than V1.1.0 with that of SDK V1.3.0 and later.

- Compile the SDK.
- For the mk3060 module, if this is your first time compiling, run the following command in the SDK root directory. This command automatically installs the toolchain for the specified module.
aos make helloworld@mk3060 - If the toolchain is already installed, run the following command in the SDK root directory.
aos make linkkitapp@mk3060After the compilation is complete, the linkkitapp@mk3060_crc.bin file is generated in the out\linkkitapp@mk3060\binary directory. This file is the firmware that you need to flash to the physical device.
If the compilation fails and an error message indicates that header files or static libraries are missing, see the FAQ.
- For the mk3060 module, if this is your first time compiling, run the following command in the SDK root directory. This command automatically installs the toolchain for the specified module.
Compile the SDK without AliOS Things
If you are developing device firmware using an SDK without AliOS Things, follow these steps to compile the SDK. The compilation process is the same for all versions of this type of SDK.
- In your development environment, decompress the downloaded SDK package.If you downloaded the SDK using Git, skip this step.
- Place your application code in the corresponding directory of the SDK.
The directory structure for an SDK without AliOS Things is shown below.
ali-smartliving-device-sdk-c ├── build-rules │ ├── docs │ ├── funcs.mk │ ├── hooks │ ├── misc │ ├── pre-build.sh │ ├── _rules-complib.mk │ ├── _rules-coverage.mk │ ├── _rules-dist.mk │ ├── _rules-flat.mk │ ├── _rules-kmod.mk │ ├── _rules-libs.mk │ ├── rules.mk │ ├── _rules-modinfo.mk │ ├── _rules-origin.mk │ ├── _rules-prefix.mk │ ├── _rules-prog.mk │ ├── _rules-repo.mk │ ├── _rules-submods.mk │ ├── _rules-top.mk │ ├── scripts │ └── settings.mk ├── CMakeLists.txt ├── components │ ├── tick_notify │ └── timer_service ├── Config.in ├── Config.linkkit ├── docs │ ├── Smart_Living_C-SDK_Adapter_for_FreeRTOS_Help_Document.pdf │ ├── Smart_Living_SDK_Reset_Feature_Introduction.pdf │ └── Smart_Living_Device_Provisioning_and_Binding_Issue_Analysis_Reference.pdf ├── examples │ ├── cJSON.c │ ├── cJSON.h │ ├── iot.mk │ └── linkkit ├── include │ ├── exports │ ├── imports │ ├── iot_export.h │ └── iot_import.h ├── lib │ ├── ANDES_N10 │ ├── ARM968E-S │ ├── Cortex-M4 │ ├── linux │ └── xtensa ├── LICENSE ├── linkkit_kv.bin ├── makefile ├── make.settings ├── output │ └── release ├── prebuilt │ ├── extra │ ├── mdm9206 │ ├── ubuntu │ └── win7 ├── project.mk ├── README.md ├── sdk-c.mk └── src ├── board ├── infra ├── protocol ├── ref-impl ├── sdk-impl ├── security ├── services └── tools - Compile the SDK.
- In the SDK root directory, run the
vim make.settingscommand to open the make.settings file. - Modify the following parameters in the file based on your hardware module and the application that you want to compile.
For detailed descriptions of the parameters, see Develop on a non-certified module.
#=========Basic Features========== FEATURE_SRCPATH="." FEATURE_MQTT_COMM_ENABLED=y FEATURE_MQTT_AUTO_SUBSCRIBE=y FEATURE_DEVICE_MODEL_ENABLED=y FEATURE_OTA_ENABLED=y FEATURE_DEV_BIND_ENABLED=y FEATURE_SUPPORT_TLS=y #Support unified service post FEATURE_DM_UNIFIED_SERVICE_POST=y #=========Basic Features========== #=========User Config Features========== FEATURE_ALCS_ENABLED=y # FEATURE_DEVICE_MODEL_GATEWAY=n # # AWSS Configurations # FEATURE_WIFI_PROVISION_ENABLED=y FEATURE_AWSS_SUPPORT_SMARTCONFIG=y FEATURE_AWSS_SUPPORT_ZEROCONFIG=y FEATURE_AWSS_SUPPORT_DEV_AP=y - Run the make distclean command.
- Run the make reconfig command. When the following prompt appears, enter the number that corresponds to your option.
Select the target platform (board) for compilation. If you are compiling the demo, select 7.
SELECT A CONFIGURATION: 1) config.esp8266.aos 6) config.rhino.make 2) config.freertos.esp8266 7) config.ubuntu.x86 3) config.macos.x86 8) config.win7.mingw32 4) config.mk3060.aos 9) config.xboard.make 5) config.mk3080.aos - Run the make command.
For example, after you compile config.ubuntu.x86, the demo file living_platform is generated in the output/release/bin directory. If you are compiling actual firmware, see SDK without AliOS Things Adaptation Guide.
- In the SDK root directory, run the