Software Development Guide for Itron Riva Dev boards

PDF - Getting Started: Software Development on Itron Riva Dev boards



Welcome to the Itron Riva Dev Software Development Getting Started Guide! The purpose of this Guide is to give you a fast path to software development on Itron Riva Dev boards:
  • Itron Riva Dev Edge boards
  • Itron Riva Dev Mini board
  • Itron Riva Dev LE board
There are several software development options when working with Itron Riva Dev Boards.

Options for the Dev Edge and Dev Mini

Both Edge and Mini are built upon Linux, which provides the following options:
  • Busybox command-line. Often a task can be performed by using an existing Busybox command-line tool. For example, the grep command (global regular expression and print result) can be used to search for patterns in files
  • BASH (Bourne Again Shell) Scripts. Often a task can be performed by developing a small shell script. Several scripts are already in use on the system, so you can find one that is close to your needs, and then modify it
  • C Programs. You can write straight C code. Many of the existing applications on the Itron Riva Dev boards are written in C
  • C++ Programs. Many of the Itron value-add programs are written in C++. The Linux based OS provides a richly featured C++ set of libraries
  • Python Scripts. [Edge only]. Currently available only for the Edge, you can write Python scripts.

Options for the Dev LE

The LE provides two major options for software development:
  • SPLC (Sensor Programmable Logic Controller) Language. This Itron developed C-based language provides a fast path to connecting sensors to the LE.
  • FreeRTOS. If the SPLC does not fit your needs, you can “go lower” into the FreeRTOS based system.


Available Interfaces

Busybox Command-line [Edge and Mini]

Both the Edge and Mini include the Busybox command-line interface. The goal of Busybox is to provide the most often used commands, with the most often used command-line options, in the smallest possible memory footprint.

You can use the busybox command to get a listing of the available commands:

busybox

As an example, suppose you wanted to use the ifconfig command to check on the number of TX bytes sent by the nano interface. You might use a command such as ifconfig nan0 | grep TX, as shown by the output below. Using the ls -l command shows that both ifconfig and grep are implemented inside busybox.

BASH Scripts [Edge and Mini]

Both the Edge and Mini include the /bin/sh and /bin/bash shell scripts. Actually, both of these shells are implemented inside of Busybox.

Let’s create the classic “hello world” shell script. Using the editor of your choice (both vi and nano are on Itron Riva Dev boards) create a file named hello.sh with the following contents:

#!/bin/bash
echo Hello Itron Riva Dev Kit


Then run the file:

# bash hello.sh
Hello Itron Riva Dev Kit


As the system starts up, some of the actions are driven by shell scripts. For example, take a look at the /etc/mcontrol.d directory, and you’ll see all the configuration files for system startup. Often these configuration files point to a bash scripts.

Note: mcontrol stands for “Master Control”, an Itron developed startup subsystem for Linux.

As an example, look at the contents of /etc/mcontrol.d/MC01-startup. This configuration file points to another file located at /etc/mcontrol.rc/RC01-startup.

 



The file located at /etc/mcontrol.rc/RC01-startup is actually a script:
etc mcontrol screenshot 2

C Programs [Edge and Mini]

Both the Edge and Mini include a C compiler in their toolchain. The toolchain runs on a Linux-based system such as Ubuntu.

The toolchain has been tested and is supported on Ubuntu 14.04 and 16.04.

The toolchain generates code for the uclibc library. In general, this library is compatible with the standard GNU glibc. However, there are some edge cases where code written using glibc may not work without change on the uclibc libary.

To install the toolchain, download the following script:

  • itron-isom-development-environment.sh

then execute the script as shown below:

$ bash itron-isom-development-environment.sh
Timesys itron-isom distribution installer (Tue Jun 06 14:12:26 2017)
Please enter the destination directory [/home/itronee/timesys]:


In the example shown, pressing ENTER will install the toolchain into the following location: /home/itronee/timesys.

After installing the toolchain, setup your PATH environment variable to point to the following directory:

  • /home/itronee/timesys/itron-isom/toolchain/bin

Here is an example of setting your PATH environment variable:

$ export PATH=/home/nmcentire/timesys/itron-
isom/toolchain/bin:$PATH


After setting the PATH, you can confirm that you can access the gcc compiler included with the toolchain.

$ armv7l-timesys-linux-uclibcgnueabi-gcc
armv7l-timesys-linux-uclibcgnueabi-gcc: fatal error: no input files
compilation terminated.



Let’s create the classic “hello world” C program. Using the editor of your choice on Ubuntu, create a file named hello.c with the following contents:

#include
int main(int argc, char *argv[]) {
puts("Running on Itron Riva Dev Board!");
return 0;
}

Now compile the code:

$ armv7l-timesys-linux-uclibcgnueabi-gcc -Wall -o hello hello.c

Using the file command, observe the file create, hello, is a binary file for the Riva Dev Edge or Mini board:

$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-uClibc.so.0, not stripped

The next step is to transfer the compiled program, in this case hello, to the Itron Riva Dev Edge or Itron Riva Dev Mini board. You have several options:

  • Minicom File Transfer. You can use minicom file transfer to send the file from your host development machine to the target test machine. On the Riva Dev board, use the lsz command to startup the send command. Then press Ctrl+a+z+s to send a file using zmodem prototol.
  • USB Storage Transfer. On the host development machine, copy the file onto a removable USB storage device. Then remove the USB Storage device and insert into the USB connector on the Itron Riva Dev board. The removable USB storage will be mounted under /media/sda1 on the Riva Dev board. You can then copy the file from the USB Storage to the Riva Dev board.
  • scp (Secure Copy). If your Itron Riva Dev boards are connected to the same network as your host development machine, then you can use scp to security copy the files. Both the Edge and the Mini have sshd (Secure Shell Daemon) running.
After copying the file to the Edge or Mini, you can execute it as follows:

$ chmod +x hello
$ ./hello
Running on Itron Riva Dev Board!


C++ Programs [Edge and Mini]

Both the Edge and Mini include the C++ compiler in their toolchain. If you followed the steps from the previous section on C Programs, then you also have a C++ compiler and libraries. Let’s create the classic “hello world” C++ program. Using the editor of your choice on Ubuntu, create a file named hello-again.cpp with the following contents:

#include

int main(int argc, char *argv[]) {
std::cout << "Hello Itron Riva Dev Board" << std::endl;
}


Now compile the code:

$ armv7l-timesys-linux-uclibcgnueabi-g++ -Wall -o hello-again hello-again.cpp

Using the file command, observe the file created, hello-again, is a binary file for the Riva Dev Edge or Mini board:

$ file hello-again
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-uClibc.so.0, not stripped

The next step is to transfer the compiled program, in this case hello-again, to the Itron Riva Dev Edge or Itron Riva Dev Mini board. You have the same options as described in the previous section: Mincom File Transfer; USB Storage Transfer; scp.

Other interfaces available include:

Python Programs [Edge Only]

SPLC Programs [LE Only]