Linux: Application Development Environment

From Compulab Mediawiki
Revision as of 15:39, 4 January 2021 by imported>Igor.vaisbein (Cross-Compilation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Development for embedded devices presents several unique challenges:

  • Software development is often done on a system other than the one on which the software will eventually run. It is common nowadays to use x86 desktop workstations to develop software for ARM-based embedded products. This approach requires cross-compilation tools and environment.
  • Communication with the embedded device is usually done remotely. This requires the use of communication tools such as ssh or serial communication programs.
  • Software deployment entails a lot of overhead: each change to the kernel version requires that all the kernel modules be replaced on the device as well. Filesystem updates can take a long time.

This article will guide you through setting up a usable development environment to tackle the unique challenges of embedded software development.

Cross-Compilation

A cross compiler makes it possible to compile software for a different system than the one on which development is done. In cross-compiler terminology, the host system is the system on which development and compilation is performed (usually an x86 workstation), while the target system is the architecture on which the software will run (such as ARM).

For application development on a PC (x86) host it is recommended to use the Linaro cross-compiler tool-chain.

Linaro Cross-Compiler Setup

Download

# cd ~/Downloads
# wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

Install

# sudo tar -C /opt -xf ~/Downloads/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

Environment Setup

# export ARCH=arm64
# export CROSS_COMPILE=/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

Communicating with the embedded device

During development communication with the embedded device is usually done using ssh, or via a serial port.

Serial port communication

The two most popular serial communication programs are minicom and kermit. Both programs also support scripting for the communication session, which can be used to automate software tests and deployment tasks.

Working with kermit

The following kermit settings should work with the vast majority of CompuLab SoM products.

  • Create a kermit.conf file with the following content:
workstation-pc # cat << eof > /path/to/kermit.conf
set carrier-watch off
set handshake none
set flow-control none 
set key \127 \008
robust
eof
  • Run kermit (set TTY to the appropriate device file, e.g. ttyS0 or ttyUSB0):
workstation-pc # sudo kermit -l /dev/<TTY> -b 115200 -y /path/to/kermit.conf
  • You should now see the kermit prompt. Type "connect" to start communicating with the device:
C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Linux+SSL+KRB5 (64-bit)
 Copyright (C) 1985, 2011,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/home/) C-Kermit> connect

ssh

ssh stands for "Secure SHell". It is an encrypted network protocol that facilitates remote login over an unsecured network. ssh can be used in advanced stages of development when the device OS has support for network communication and a running user space. Using ssh requires knowing the IP address of the embedded device, so if it is not known in advance you will have to access the device in some other way and query it using the ifconfig command. For this reason ssh is best used as an alternative means of communication with the device.

  • Make sure your workstation is in the same network as the device, and initiate the ssh connection:
workstation-pc # ssh root@<device IP address>