Filter results by

Customizing ARTIK 05X

Having compiled, loaded, and played with the base version of Tizen RT, you can now customize it to use your chosen applications. Although you can manually edit the configuration files, the kconfig-frontend tools are the best choice to add and remove apps and features from the base version of Tizen RT.

Customization Overview

You can choose the apps that you want to be able to run from the command line interface (CLI). First, we'll explain how it would be done manually. This definition file:

build/configs/artik053/<cfg>/defconfig

selects the apps you want to have listed by the TASH> help command. You'll see from the format of the defconfig file how an app is enabled or disabled.

If you were using the nettest configuration, for example, you might edit the file like this:

  vim build/configs/artik053/nettest/defconfig

defconfig must be edited prior to configuring the build with config.sh, which creates a hidden os/.config file based on defconfig. If you want to make changes after that, edit os/.config directly or use Kconfig tools.

Editing manually is not advised, as you may miss dependencies that Kconfig takes care of automatically.

Installing Kconfig Tools

The Tizen RT system is highly configurable and the configuration files are maintained through the kconfig-frontends tool. Each Kconfig file contains declarations for the required configuration variables and provides one configuration option for Tizen RT.

  1. Open a bash terminal window.

  2. Change to main directory.
    cd ~/ARTIK05X

  3. Install the Kconfig-frontend for Tizen RT menu configuration.

    git clone https://bitbucket.org/nuttx/tools.git tools

    cd tools/kconfig-frontends

    ./configure --enable-mconf --disable-gconf --prefix=/usr

    make

    sudo make install

Adding/Removing Apps

Use the Kconfig GUI menu to set options. We're going to start you off on the Sensor Board app.

  1. From within your tinyara/os directory, run:
    make menuconfig
    to arrive at the entry screen.

  2. Scroll down to Application Configuration (it may initially be below the bottom of the screen) and hit Enter to select.

  3. On the sub-menu select Examples....

  4. Scroll down to Sensor Board Example and hit the space bar to select.

  5. Select Save and then exit from the program.

All the settings are stored in the hidden os/.config file. If you re-initialize your configuration (make distclean) you will lose any changes you made.

Coding

You built the unmodified code in the previous article to verify that it would run as expected. Now, as you get started on coding for real, here is some information to get you familiar with the layout.

  • build/configs/artik053, 053s, or 055s contains the <cfg> directories for selecting the project type (minimal, typical, extra, nettest).
  • <cfg>/defconfig lists the specific apps to include or exclude for each configuration.
  • apps/examples/ contains the source code for each of those apps.
  • Running the config.sh script as you did here generates an os/.config file from defconfig.
  • You customize the contents of os/.config using the menuconfig command associated with Kconfig.
  • os/arch/arm/src/artik05x/src/artik05x_boot.c contains the mapping of GPIO pins.

The Sensor Board example is a good place to start to try modifying code. You'll find it under apps/examples/sensorbd_demo/examples. You can play with your app in the first Tutorials article.

MQTT Example

If you're familiar with MQTT, try out this easy exercise to see how quickly you can be publishing from your ARTIK 05X module.

Prerequisites

You'll need an MQTT broker to be set up and ready to receive your publications. You could set up mosquitto as a broker and MQTT.fx as a subscriber or publisher on your development PC, for example.

If you have an ARTIK 5/7/10 module, you can use it instead with our Node-RED tutorial. That is, with Wi-Fi up and running on your board, enter:
   mosquitto -v &
   node-red &

Preparation

Starting from a fresh configuration and kconfig running, do the following.

  1. Scroll down to Application Configuration.

  2. Go to Network Utilities... and select MQTT followed by MQTT with security

  3. Exit from that page.
  4. Go to Examples... and select "MQTT Test" example

  5. Save your changes and exit the configuration tool.
  6. Build and load the image to your ARTIK 05X board as always.

Procedure

Have your MQTT broker ready to receive your message. You'll need to know its IP address.

  1. Reset your board and get to the TASH> prompt. Verify that mqtt_pub is now in your help list.

  2. Manually set up Wi-Fi as you did here. Make sure you're using the same Wi-Fi access point as your MQTT broker is using.

  3. Send an MQTT publish request, specifying host, port, topic, and message.

For example:

mqtt_pub -h 10.0.0.36 -p 1883 -t brightness -m "100"

That's all there is to it! You should see the message pop up on your MQTT broker screen.

Creating Tizen RT SDK

The Tizen RT SDKs used by the ARTIK IDE are created from Tizen RT source code and made available to the IDE through SDK Update. These SDKs come with pre-built Tizen RT System Configurations that you can use to develop your application.

You can create your own custom Tizen RT system configuration (that is, choosing the modules you want included/excluded for build) using a command line tool.

You develop with a new SDK by configuring and building it, then choosing it for a project. Refer to the Creating Tizen RT SDK article for details.

Preparation

Before using this SDK tool, you must have set up your development environment and gotten comfortable using the kconfig customization tool. Once you are ready, you will use the command line tool to generate the SDK. There are two forms:

tizenrt-system-config.py -s SOURCE -e IDE [options]
    to generate a new SDK

tizenrt-system-config.py -p SDK_PATH [options]
    to add a custom configuration to an existing SDK

where:
SOURCE is the path of the Tizen RT source code
IDE is the path of the ARTIK IDE
SDK_PATH is the path of the existing SDK

and options are:
-b or --nconfig is the new configuration name (default: 'custom')
-t is the toolchain path (needed if not already in PATH)
-d or --description is a descriptive phrase for the configuration
-v or --nsdk is the new SDK name, not used if -p is specified (default: 'custom')
-a or --arch is the architecture of the board (default: A053)
-c or --sconfig is the start configuration (default: 'typical').

Configure and build a new SDK

Follow these steps, where we've used ~/ARTIK as the name of the directory where the ARTIK IDE has been installed.

If using a Windows host PC, launch a msys2.exe shell (find it in the <ARTIK Installation>\tools\msys folder) to run the commands below. The Tizen RT system configuration will not work if launched from a Windows command shell.

  1. Go to the ARTIK IDE directory containing the tool. For ARTIK IDE 1.4 and newer, it is in a subdirectory of the installed SDK. In SDK v1.7, for example:
    cd ~/ARTIK/SDK/A053/v1.7/tools/external-system-config
    For ARTIK IDE v1.3, the location is always the same:
    cd ~/ARTIK/tools/external-system-config

  2. Run
    tizenrt-system-config.py -s SOURCE -e IDE [options]
    to start the program, which will launch the kconfig tool. For example:

    1
     ./tizenrt-system-config.py -s ~/ARTIK/SDK/A053/v1.2/source/tinyara -e ~/ARTIK

    If you wanted to additionally specify a description for the user:

    1
     ./tizenrt-system-config.py -s ~/ARTIK/SDK/A053/v1.2/source/tinyara -e ~/ARTIK -d "this is a new SDK created by the command line tool"
  3. Make changes to the configuration as described previously.

  4. Save your changes to the default .config file as always, then exit.

  5. Wait for the program to build the new SDK.

Select Created SDK

Once you have created or updated an SDK, it will be available when starting a new project.

The image below shows an added SDK in the selector. The name defaults to 'custom' unless you changed it using the -b option with tizenrt-system-config.py.

Create a new configuration in the existing SDK

To simply bring a new configuration into the existing SDK, the procedure is similar to that above, except that you'll use a different form of the command line.

tizenrt-system-config.py -p SDK_PATH [options]

For example:

./tizenrt-system-config.py -p ~/ARTIK/SDK/A053/v1.2 

Refer to the Creating Tizen RT SDK article for more information.



Last updated on: