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.
-
Open a bash terminal window.
-
Change to main directory.
cd ~/ARTIK05X
-
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.
-
From within your
tinyara/os
directory, run:make menuconfig
to arrive at the entry screen. -
Scroll down to
Application Configuration
(it may initially be below the bottom of the screen) and hit Enter to select. -
On the sub-menu select
Examples...
. -
Scroll down to
Sensor Board Example
and hit the space bar to select. -
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
, or055s
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 anos/.config
file fromdefconfig
. - You customize the contents of
os/.config
using themenuconfig
command associated withKconfig
. 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.
-
Scroll down to
Application Configuration
. -
Go to
Network Utilities...
and selectMQTT
followed byMQTT with security
- Exit from that page.
-
Go to
Examples...
and select"MQTT Test" example
- Save your changes and exit the configuration tool.
- 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.
-
Reset your board and get to the
TASH>
prompt. Verify thatmqtt_pub
is now in yourhelp
list. -
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.
-
Send an MQTT publish request, specifying
h
ost,p
ort,t
opic, andm
essage.
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, having chosen the modules you want included/excluded for build) using the Python-based command line tool described here. It gets copied in when you install ARTIK IDE v2.0.0.
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 is just one form – it either generates a new SDK, or adds a custom configuration to an existing SDK.
tizenrt-system-config.py [options]
where options are:
-v
or --nsdk
is the new or existing SDK name;
if existing, a custom configuration is created within the specified SDK
-b
or --nconfig
is the new configuration name
-t
is the toolchain path
-d
or --description
is a descriptive phrase for the configuration
-m
or --module
is the module name (currently supported: A053
,A053s
,A055s
)
-c
or --sconfig
is the starting configuration.
Example:
1 | ./tizenrt-system-config.py -m A053 -v custom_sdk -c extra -b custom_configuration -d 'This is the custom SDK generated by external tools' -t /home/user/ARTIK/toolchains/gcc-arm-none-eabi/v4.9-2015q3/bin |
where, if custom_sdk
is:
-
a new SDK name, generates a new SDK (
custom_sdk
) including a new custom configuration (custom_configuration
). -
an existing SDK name, generates a new
custom_configuration
within the existing SDK.
If these operations occur while the ARTIK IDE is already open, you must restart it to let the new SDK or new configuration work.
Do not perform any other Tizen RT system-configuration-related operations while the tool is executing.
Case 1: Create a new SDK and new Configuration
If you want to add a full customized Tizen RT SDK with any other officially released SDK to the SDK path of the IDE, use this procedure.
-
Use the command line above, where
custom_sdk
is a new SDK name. The command generates a new SDK (custom_sdk
) including a new custom configuration (custom_configuration
). -
After configuring Tizen RT with the features you want, choose Save and Exit.
-
Wait until Tizen RT is built.
-
Create a new project with this SDK and configuration.
Case 2: Create a new configuration within an existing SDK
If you want to add a new customized configuration to an existing SDK when Tizen RT source code in IDE, use this procedure.
-
Use the command line above, where
custom_sdk
is an existing SDK name. The command generates a new custom configuration (custom_configuration
) within the existing SDK. -
After configuring Tizen RT with the features you want, choose Save and Exit.
-
Wait until Tizen RT is built.
-
Create a new project with this configuration.
Do not use the system configuration CLI tool and the ARTIK IDE system configuration function at the same time. Cross-use conflicts will occur. {.info}
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.
-
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
-
Run the command. Here we take the example command from above but leave off the description.
./tizenrt-system-config.py -m A053 -v custom_sdk -c extra -b custom_configuration -t /home/user/ARTIK/toolchains/gcc-arm-none-eabi/v4.9-2015q3/bin
Doing so launches the
kconfig
tool. -
Make changes to the configuration as described previously.
-
Save your changes to the default
.config
file as always, then exit. -
Wait for the command line 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
.
Refer to the Creating Tizen RT SDK article for more information.