Linux Embedded

Notice: The Linux Embedded Client SDK does not include a W3bstream Client object. To create API calls, you will need to utilize the HTTP/MQTT clients directly. Detailed examples can be located within the SDK repository for your reference.

Go to the examples folder...

Set up the build environment

Iotex SDK officially supports a limited set of build environments and setups. In this context, official support means that the environments listed below are actively used by team members and active developers, hence users should be able to recreate the same configurations by following the instructions described below. In case of problems, the Iotex SDK team provides support only for these environments, but building in other environments can still be possible.

The following environments are supported:

Docker container (Ubuntu 22.04)

Install the VS Code Remote: Dev containers extension. Open the repository inside VS Code and click the "Open Workspace in Container" pop up that appears. More info on using dev containers in VS Code in the VS Code documentation.

Linux (Ubuntu 18.04 or 22.04)

Run the following command to install the required dependencies:

sudo apt-get install -y cmake git curl wget build-essential libssl-dev python3

Windows 11 x64

Install the following dependencies:

Get the source code

Run the following command to clone the repository:

git clone https://github.com/machinefi/web3-iot-sdk.git

Build

The build process is managed by CMake. The build can be customized by passing CMake options. For a full list of CMake options see the main CMakeLists.tx. Below is a description of the most common ones:

  • CRYPTO_IMPL: the crypto library to use. Possible values: "MbedTLS" or "TinyCrypt". Defaults to "MbedTLS". Note that TinyCrypt is not supported yet.

  • BUILD_IOTEX_F: build the IoTeX Firmware component. Defaults to ON.

  • BUILD_PSA_TEST_SUITE: build the PSA Architecture test suite. Defaults to OFF.

  • BUILD_EXAMPLE_<example_name>: build any of the examples in the examples directory. Defaults to OFF.

  • GIT_SUBMODULE_UPDATE: download or update any dependencies specified as submodules. Defaults to ON.

For example, if you want to build the SDK using Iotex Firmware + MbedTLS + PSA test suite, you can run the following commands:

# Configure the build components and place the output in ./build-out
cmake -DGIT_SUBMODULE_UPDATE=ON -DBUILD_IOTEX_F=ON -DCRYPTO_IMPL="MbedTLS" -DBUILD_PSA_TEST_SUITE=ON -S ./ -B ./build-out
# Compile all targets
cmake --build build-out --target all

Once the build finishes, you can run the tests executable using the following command:

./build-out/test/psa-arch-tests-crypto

You should see output similar to the one below:

...
******************************************

TEST: 260 | DESCRIPTION: Testing crypto AEAD APIs | UT: psa_aead_abort
[Info] Executing tests from non-secure
[Check 1] Test psa_aead_abort - Encrypt - CCM - AES
[Check 2] Test psa_aead_abort - Encrypt - GCM - AES
[Check 3] Test psa_aead_abort - Decrypt - CCM - AES
[Check 4] Test psa_aead_abort - Decrypt - GCM - AES
[Check 5] Test psa_aead_abort with all initializations

TEST RESULT: PASSED

******************************************

......

************ Crypto Suite Report **********
TOTAL TESTS     : 63
TOTAL PASSED    : 61
TOTAL SIM ERROR : 0
TOTAL FAILED    : 0
TOTAL SKIPPED   : 2
******************************************

Examples

Examples to demonstrate the usage of the SDK can be found in the examples of the SDK. Each example contains a README file with usage instructions.

Last updated