This article will help the intended reader in setting up an environment for Embedded Linux application development. The resulting environment enables cross-platform application development for Toradex ARM-based SOMs/COMs using a typical Linux desktop workstation for application development.
Please refer to the release notes document for information concerning a specific image. The release notes can be found at the Linux BSP Release.
The following block diagram illustrates the hardware setup suitable for development.
There are a few ways to have a development workstation setup. Some (but not all) examples are given below:
Cross Compilation Toolchain:
Target Root File System:
IDE:
In the present article, the following is used: Linaro or OpenEmbedded generated cross toolchain, Toradex Embedded Linux pre-built image root file system and Eclipse IDE provided in the distribution feeds. In the subsequent article Hello World application on Embedded Linux, it is presented how to configure Eclipse using the Linaro toolchain.
For beginners, the step-by-step Getting Started Guide uses pre-built OpenEmbedded SDK and Eclipse IDE from the Eclipse Installer. It explains comprehensively how to configure Eclipse to use the toolchain and root file system provided by the SDK.
When you start using Yocto/OpenEmbedded, the Linux SDKs article uses custom SDK built with OpenEmbedded and Eclipse IDE (assumed it is already installed). It explains objectively how to configure Eclipse to use the toolchain and root file system provided by the SDK.
One can choose any Linux distribution (like Fedora, SUSE, Debian) for development. A 64-bit install is preferred as you might want to use the machine also for OpenEmbedded work. Cross-compiling certain packages requires the larger address space available. Also, the latest cross toolchains from Linaro are provided only for 64-bit hosts. Should you choose Ubuntu, use the bash shell instead of dash. (Google for 'ubuntu bash update-alternatives')
In this article, we will be using Ubuntu 14.04. Visit the Ubuntu website to explore how to install Ubuntu on your development workstation.
To start a terminal on the host:
In Gnome Desktop Environment:
Applications menu -> Accessories -> Terminal
In Unity Desktop Environment:
In the launcher click the 'Dash home' icon
Dash -> enter 'Terminal' in the search box
Dash -> click 'Terminal' in found results, a new Terminal window opens, a Terminal icon appears in the Launcher
Right click the new Terminal icon, click 'Lock to Launcher' to have it permanently attached to the Launcher
At the host terminal:
E.g. for Ubuntu 14.04:
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential meld git gawk eclipse-cdt eclipse-cdt-launch-remote eclipse-rse minicom sudo apt-get install gtk+-2.0-dev #if you have a 64-bit Linux host install your distributions 32-bit compatibility libraries. sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libz1:i386 libncurses5:i386 libbz2-1.0:i386 libstdc++6:i386
The latest Linux images are available at:
Download the latest image for your module and extract the archive on the host machine with root privileges. For example:
sudo mkdir -p /srv/nfs cd /srv/nfs sudo wget http://files.toradex.com/Colibri/Linux/Images/Colibri_T20_LinuxImageV2.4Beta1_20150518.tar.bz2 sudo tar xjvf Colibri_T20_LinuxImageV2.4Beta1_20150518.tar.bz2
The rootfs will be used on the host machine to compile and link against. The extracted files will also be used later to flash the full image onto the target.
Create a symbolic link to have the target root file system at a stable location. For example:
cd /srv/nfs sudo ln -s Colibri_T20_LinuxImageV2.3/rootfs rootfs cd
Note: In this example, the link is placed to an NFS server path. Any path may be used for software development; however, by hosting the rootfs on an NFS server it is possible for the target device to mount the rootfs via the network allowing simultaneous access to the live rootfs by both target & host.
A cross-toolchain (often times just called cross-compiler) is used to build an application on the host which later on can be executed on the target device.
Select from the tabs below the Embedded Linux BSP release for which you want to install a compatible toolchain:
Beginning with BSP 5, as part of our OpenEmbedded Dunfell update we transitioned to using version 9.3 of the gcc compiler. Arm releases well tested binary toolchains which can be used to cross-compile software for our modules. At the time of this writing, Arm has not released gcc 9.3 compilers as of yet. Therefore, just use the version 9.2 ones for now:
You have to choose to download either the 32 bit or 64 bit Arm cross-toolchain, according to the architecture of your Computer on Module SoC. Select the correct one from the tabs below:
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz?revision=fed31ee5-2ed7-40c8-9e0e-474299a3c4ac&la=en&hash=76DAF56606E7CB66CC5B5B33D8FB90D9F24C9D20"
$ tar xvf gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz
$ ln -s gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm
$ export DTC_FLAGS="-@"
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-none-linux-gnueabihf-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm" >> ~/export_compiler
$ echo "export DTC_FLAGS='-@'" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=arm-none-linux-gnueabihf-" >> ~/export_compiler
$ source ~/export_compiler
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz?revision=61c3be5d-5175-4db6-9030-b565aae9f766&la=en&hash=0A37024B42028A9616F56A51C2D20755C5EBBCD7"
$ tar xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
$ ln -s gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm64
$ export DTC_FLAGS="-@"
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=aarch64-none-linux-gnu-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm64" >> ~/export_compiler
$ echo "export DTC_FLAGS='-@'" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=aarch64-none-linux-gnu-" >> ~/export_compiler
$ source ~/export_compiler
Beginning with BSP 4, as part of our OpenEmbedded Zeus update we transitioned to using version 8.3 of the gcc compiler. Arm releases well tested binary toolchains which can be used to cross-compile software for our modules:
You have to choose to download either the 32 bit or 64 bit Arm cross-toolchain, according to the architecture of your Computer on Module SoC. Select the correct one from the tabs below:
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&la=en&hash=93ED4444B8B3A812B893373B490B90BBB28FD2E3"
$ tar xvf gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz
$ ln -s gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-linux-gnueabihf-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=arm-linux-gnueabihf-" >> ~/export_compiler
$ source ~/export_compiler
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz?revision=2e88a73f-d233-4f96-b1f4-d8b36e9bb0b9&la=en&hash=167687FADA00B73D20EED2A67D0939A197504ACD"
$ tar xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
$ ln -s gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm64
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=aarch64-linux-gnu-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm64" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=aarch64-linux-gnu-" >> ~/export_compiler
$ source ~/export_compiler
Beginning with image 3.0, as part of our OpenEmbedded Thud update we transitioned to using version 8.2 of the gcc compiler. Arm releases well tested binary toolchains which can be used to cross-compile software for our modules:
You have to choose to download either the 32 bit or 64 bit Arm cross-toolchain, according to the architecture of your Computer on Module SoC. Select the correct one from the tabs below:
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu-a/8.2-2019.01/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz?revision=c69ea519-a965-4359-84a4-cbd440ff4130&la=en&hash=09C47C70EEE96D17EA036A7A59AE961972320A31"
$ tar xvf gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz
$ ln -s gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-linux-gnueabihf-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=arm-linux-gnueabihf-" >> ~/export_compiler
$ source ~/export_compiler
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu-a/8.2-2019.01/gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu.tar.xz?revision=21270570-4ec0-4bad-a9e1-09707614066a&la=en&hash=AFEDF645AF5B94336DB4E1E608806CEC87A02B8A"
$ tar xvf gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu.tar.xz
$ ln -s gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm64
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=aarch64-linux-gnu-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm64" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=aarch64-linux-gnu-" >> ~/export_compiler
$ source ~/export_compiler
Beginning with image 2.8, as part of our OpenEmbedded Rocko update we transitioned to using version 7.3 of the gcc compiler. Linaro releases well tested binary toolchains which can be used to cross-compile software for our modules:
https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/
To install the toolchain on your host machine, download and unpack the tar.xz file. From the command-line:
$ cd ~
$ wget -O gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz "https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz"
$ tar xvf gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
$ ln -s gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf gcc-linaro
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-linux-gnueabihf-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=arm-linux-gnueabihf-" >> ~/export_compiler
$ source ~/export_compiler
Beginning with image 2.7b2, as part of our OpenEmbedded Morty update we transitioned to using version 6.2 of the gcc compiler. Linaro releases well tested binary toolchains which can be used to cross-compile software for our modules (choose gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz):
https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/
Beginning with image V2.6, as part of our OpenEmbedded Jethro update we transitioned to using version 5.2 of the gcc compiler. Linaro releases well tested binary toolchains which can be used to cross-compile software for our modules (choose gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz):
https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf/
Beginning with image V2.0, we transitioned to using the hard-float ABI:
https://releases.linaro.org/archive/14.11/components/toolchain/binaries/
Note: Since the 14.11 release Linaro only provides x86_64 toolchains. If you use 32-bit Linux on your host machine (check using uname -m), you can still download the older 14.09 release which is still 32-bit:
https://releases.linaro.org/archive/14.09/components/toolchain/binaries/
You have to choose to download either the 32 bit or 64 bit Arm cross-toolchain, according to the architecture of your Computer on Module SoC. Select the correct one from the tabs below:
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.
$ export ARCH=arm
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-linux-gnueabihf-
You can put those commands into a file and source that file to export it more easily, E.g.:
$ echo "export ARCH=arm" >> ~/export_compiler
$ echo "export PATH=~/gcc-linaro/bin/:$PATH" >> ~/export_compiler
$ echo "export CROSS_COMPILE=arm-linux-gnueabihf-" >> ~/export_compiler
$ source ~/export_compiler
Warning: on the BSP version 4.0 of BSP Layers and Reference Images for Yocto Project, Toradex started to use dropbear for SSH service and disable-weak-ciphers
is enabled by default. When trying to use the Eclipse SSH connection - remote system explorer and SSH connection in debug feature - it fails because it seems that Eclipse still uses some weak ciphers (tested with 4.16 and 4.12). Add the line PACKAGECONFIG_remove_pn-dropbear = " disable-weak-ciphers"
to local.conf and rebuild the Yocto image.
At the host terminal:
eclipse
Accept the default workspace location. Once on the welcome screen click "Workbench". You might want to have Eclipse on the launcher. Right click the Eclipse icon in the launcher and click 'Lock to Launcher'.
Minicom is a virtual terminal application. We will use it to see console output from the target during boot and may use it to login and work with the Linux command line on the target.
Put yourself into the dialout group (or whatever is needed to have access rights to serial devices in your distribution). Configure minicom for the serial port you will be using on your host, 115200 8N1 no hardware flow control. Set init, reset and hang-up modem control strings to empty and set modem has DCD line to no.
Save your minicom configuration as default. (Save setup as dfl)
sudo adduser YOUR_USER dialout sudo minicom -s +-----[configuration]------+ | Filenames and paths | | File transfer protocols | | Serial port setup | | Modem and dialing | | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | | Exit from Minicom | +--------------------------+ +-----------------------------------------------------------------------+ | A - Serial Device : /dev/ttyUSB0 | | B - Lockfile Location : /var/lock | | C - Callin Program : | | D - Callout Program : | | E - Bps/Par/Bits : 115200 8N1 | | F - Hardware Flow Control : No | | G - Software Flow Control : No | | | | Change which setting? | +-----------------------------------------------------------------------+ +--------------------[Modem and dialing parameter setup]---------------------+ | | | A - Init string ......... | | B - Reset string ........ | | C - Dialing prefix #1.... ATDT | | D - Dialing suffix #1.... ^M | | E - Dialing prefix #2.... ATDP | | F - Dialing suffix #2.... ^M | | G - Dialing prefix #3.... ATX1DT | | H - Dialing suffix #3.... ;X4D^M | | I - Connect string ...... CONNECT | | J - No connect strings .. NO CARRIER BUSY | | NO DIALTONE VOICE | | K - Hang-up string ...... | | L - Dial cancel string .. ^M | | | | M - Dial time ........... 45 Q - Auto bps detect ..... No | | N - Delay before redial . 2 R - Modem has DCD line .. No | | O - Number of tries ..... 10 S - Status line shows ... DTE speed | | P - DTR drop time (0=no). 1 T - Multi-line untag .... No | | | | Change which setting? (Return or Esc to exit) | +----------------------------------------------------------------------------+
Warning: this section is outdated. Starting with BSP 3.0 Toradex dropped the Ångström distribution on its BSP Layers and Reference Images for Yocto Project and moved to a Poky-based image. It means that no desktop environment and no SDK are provided, and you will most likely need to do a custom Yocto build. If you look for ease-of-use, Toradex recommends Torizon.
You should already have downloaded and extracted the appropriate Linux image to your host machine. If you skipped this step, then do it now.
Our latest Embedded Linux BSP demo images & release notes are provided at:
Note: We have developed Toradex Easy Installer for updating OS on Toradex Module. Please check below article for more detail.
When the update is complete the target should be booting the latest Linux OS.
ip addr
At the target device's terminal:
connman-properties
In the opening dialog:
For a more complex network setup, refer to How to setup Networking for Embedded Linux Application Development.
You're now ready to write your first application! Continue with the Hello World application on Embedded Linux.