Difference between revisions of "Tizen RT - Step by Step Guide for running Sample Application on ARTIK 053"

From Tizen Wiki
Jump to: navigation, search
(Created page with "Tizen RT is a lightweight RTOS-based platform to support low-end IoT devices. This getting started document will show how to setup the development environment, download sourc...")
 
Line 200: Line 200:
 
|}
 
|}
  
[[File:TizenRT StepbyStep ARTIK053 OSA 9.JPG | 700px]]
+
[[File:TizenRT StepbyStep ARTIK053 OSA 10.JPG | 700px]]
 +
 
 +
If "ftdi_sio" is listed as the image above then unload it running the commands as follows.
 +
 
 +
{| class="wikitable"
 +
|-
 +
| sudo rmmod ftdi_sio
 +
| sudo rmmod usbserial
 +
|}
 +
 
 +
Run the command (sudo lsmod) to show the list again. Now, it’ll not appear in the list as below:
 +
 
 +
[[File:TizenRT StepbyStep ARTIK053 OSA 11.JPG | 700px]]
 +
 
 +
If it still shows, it's possible that libftd2xx does not recognize your device's Vendor and Product Identifiers.
 +
 
 +
Now run the read command again (sudo ./read) and find the result as per below image:
 +
 
 +
[[File:TizenRT StepbyStep ARTIK053 OSA 12.JPG | 700px]]
 +
 
 +
'''Download Tizen RT:'''
 +
 
 +
Tizen RT is open-source code. The repository can be found into this link: https://github.com/SamsungARTIK/TizenRT/
 +
 
 +
Download the project in .zip format from that URL. Create a directory as: ARTIK053/tinyara in home directory and keep all the contents in that directory like below after uncompressing:
 +
 
 +
~/ARTIK053/tinyara
 +
 
 +
[[File:TizenRT StepbyStep ARTIK053 OSA 13.JPG | 700px]]
 +
 
 +
The folder structure should be as the above image.
 +
 
 +
'''Configure Tizen RT:'''
 +
 
 +
To configure for building, at first the directory should be changed as below:
 +
 
 +
{| class="wikitable"
 +
|-
 +
| cd ~/ARTIK053/tinyara/os/tools
 +
|}
 +
 
 +
Configure to typical build config by using below command:
 +
 
 +
{| class="wikitable"
 +
|-
 +
| ./configure.sh artik053/typical
 +
|}
 +
 
 +
The script will initialize the Tizen RT’s typical configuration, preparing it for building.
 +
 
 +
'''Compile Tizen RT:'''
 +
Before compiling Tizen RT, make sure the build process can find toolchain. Verify that the setting is correct (it was set in ~/.bashrc using Vi editor in the 3rd step of Development Environment Setup section). Run the command below: Change to home directory and run the below command:
 +
 
 +
{| class="wikitable"
 +
|-
 +
| echo $CROSSDEV
 +
|}

Revision as of 09:13, 7 December 2017

Tizen RT is a lightweight RTOS-based platform to support low-end IoT devices. This getting started document will show how to setup the development environment, download source code, compile/build Tizen RT and eventually flash and run a sample application on a low-end IoT device. For this purpose we have chosen: ARTIK053 (with starter kit). Information about ARTIK053 starter kit: https://www.artik.io/modules/artik-053/

Development Environment Setup:

For this tutorial, Ubuntu 16.04 Linux machine is used with internet connectivity.

Step 1: At first, Update and installation of some packages are required for setup. Update is needed to get information on the newest versions and their dependencies. Package installation is also necessary to set up the environment for running a flexible GNU development environment and flashing over the JTAG interface.

Open up the command terminal and execute the commands below:

sudo apt-get update

sudo apt-get install git gperf libncurses5-dev flex bison

sudo apt-get install openocd libusb-1.0

Step 2: This step ensures the Installation of toolchain. Toolchain is a tool that produces executables to run on a different architecture (e.g. ARM).

Installation of ARM toolchain is done by executing the command below:

sudo apt-get install gcc-arm-none-eabi

Step 3: After installation, edit the bash init script to add the correct tool chain path prefix.

The command below will allow editing the .bashrc file. (More information about the usage of Vi editor is available at: https://www.tutorialspoint.com/unix/unix-vi-editor.htm)

vi ~/.bashrc

Add the line below at the end of file (using Vi editor’s insert mode).

export CROSSDEV=arm-none-eabi-

After adding the lie at the end, it may look as below:

TizenRT StepbyStep ARTIK053 OSA 1.jpg

To exit the editor, press Esc to exit from insert mode. Then Press: “:q!” to exit.

TizenRT StepbyStep ARTIK053 OSA 2.jpg

Please check if the above mentioned line is saved in .bashrc file by re-opening the file. If you face trouble editing with “Vi editor” then find the ~/.bashrc file (In home directory by using keyboard shortcut Ctrl + H) and edit using a text editor.

Do not proceed until you are confirmed this change is done.

Step 4: Restart the PC for changes to take effect.

Step 5: This step is about Installing & Configuring a serial communication program.

Installation of serial communication programs is required to listen to the specified device port and provide a serial console. Recommended programs are listed as below:

 Minicom

 Screen

Minicom is selected for this tutorial.

Before installing Minicom, Open up command terminal in home directory and connect the ARTIK053 starter kit using a USB cable. The starter kit may look as below (with a light being ON):

TizenRT StepbyStep ARTIK053 OSA 3.JPG

Then run the command below to find port name.

dmesg | tail | grep tty

The result of the above command may look as the image below:

TizenRT StepbyStep ARTIK053 OSA 4.JPG

Anyone of the ports i.e. ttyUSB0 or ttyUSB1 can be used for configuring Minicom.

Now, installation of Minicom can be done using the command below:

sudo apt-get install minicom

Once installation is done, it is ready for configuration. To start Minicom in configuration mode use the command below:

sudo minicom –o –s

This command will allow configuring Minicom as the below image:

TizenRT StepbyStep ARTIK053 OSA 5.JPG

Scroll down to the Serial port setup and hit Enter. Now, it’ll open an interface like the image below:

TizenRT StepbyStep ARTIK053 OSA 6.JPG

Using the alphabet letters indicated, select serial port settings to change. Here it’s set to ttyUSB1. Change the settings according to the above image.

Now, press Enter by itself to leave this screen. After that, select 'Save setup as dfl', and then select 'Exit' from Minicom.

When setting up for the first time, it may not show the 'Save setup as dfl’ option. In that case, select the option as the below image:

TizenRT StepbyStep ARTIK053 OSA 7.JPG

It’ll allow entering the name as the image below:

TizenRT StepbyStep ARTIK053 OSA 8.JPG

Enter dfl and then select Exit.

From next time, it’ll show 'Save setup as dfl’ option in the list. In this stage Minicom configuration is complete.

Step 6: This step talks about Installing D2XX driver. D2XX drivers allow direct access to the USB device through a DLL.

Please go to the link below to download D2XX driver: http://www.ftdichip.com/Drivers/D2XX.htm

Download driver depending upon the dev PC, in this case for Linux (x64) from the chart as shown in the image below:

TizenRT StepbyStep ARTIK053 OSA 9.JPG

Download .tgz file in home directory.

Then using command terminal, execute the command below to unpack downloaded archive. (Please modify the platform name as per dev PC’s config)

tar xfvz libftd2xx-x86_64-1.4.6.tgz

Now, enter into the release/build using the command below:

cd release/build

Run the below command to promote current user to super-user to use installation privileges:

sudo -s

or log in as root user by running below command (if sudo is not available on your system run):

su

Copy libraries to a central location using the command below:

cp libftd2xx.* /usr/local/lib

Allow non-root access to the shared object by using:

chmod 0755 /usr/local/lib/libftd2xx.so.1.4.6

Create a symbolic link to the 1.4.6 version of the shared object by:

ln -sf /usr/local/lib/libftd2xx.so.1.4.6 /usr/local/lib/libftd2xx.so

End super-user session.

exit

Now, for building the shared-object examples, change the directory to ~release/examples. Then run the command below:

make –B

This builds all the shared-object examples in subdirectories. With an FTDI device (in this case ARTIK053 starter kit) connected to a USB port, try one of the examples, e.g. reading EEPROM by changing the directory to EEPROM/read. Then run this command:

sudo ./read

If the message "FT_Open failed" appears, it may mean the kernel automatically loaded another driver for the FTDI USB device. Run the below command and find "ftdi_sio" in the list.

sudo lsmod

TizenRT StepbyStep ARTIK053 OSA 10.JPG

If "ftdi_sio" is listed as the image above then unload it running the commands as follows.

sudo rmmod ftdi_sio sudo rmmod usbserial

Run the command (sudo lsmod) to show the list again. Now, it’ll not appear in the list as below:

TizenRT StepbyStep ARTIK053 OSA 11.JPG

If it still shows, it's possible that libftd2xx does not recognize your device's Vendor and Product Identifiers.

Now run the read command again (sudo ./read) and find the result as per below image:

TizenRT StepbyStep ARTIK053 OSA 12.JPG

Download Tizen RT:

Tizen RT is open-source code. The repository can be found into this link: https://github.com/SamsungARTIK/TizenRT/

Download the project in .zip format from that URL. Create a directory as: ARTIK053/tinyara in home directory and keep all the contents in that directory like below after uncompressing:

~/ARTIK053/tinyara

TizenRT StepbyStep ARTIK053 OSA 13.JPG

The folder structure should be as the above image.

Configure Tizen RT:

To configure for building, at first the directory should be changed as below:

cd ~/ARTIK053/tinyara/os/tools

Configure to typical build config by using below command:

./configure.sh artik053/typical

The script will initialize the Tizen RT’s typical configuration, preparing it for building.

Compile Tizen RT: Before compiling Tizen RT, make sure the build process can find toolchain. Verify that the setting is correct (it was set in ~/.bashrc using Vi editor in the 3rd step of Development Environment Setup section). Run the command below: Change to home directory and run the below command:

echo $CROSSDEV