Tibbo LTPS Native C Development How To

by Dmitry_Dvorkin in Circuits > Linux

812 Views, 4 Favorites, 0 Comments

Tibbo LTPS Native C Development How To

324661.jpg

LTPP is a Linux-based Tibbo Project PCB (TPS mainboard) based on the powerful 1GHz Cortex-A8 Sitara CPU from Texas Instruments. Carrying 512MB of RAM and 512MB of flash memory, the new LTPP3 board runs Tibbo’s own, highly polished distribution of Linux that is updated with the latest and greatest kernel and drivers.

LTPP may be programmed and managed in several different ways: the Tibbo-supplied Embedded AggreGate (purchased separately), NodeJS (comes pre-installed), TiOS (not yet fully ported). Tibbo also says that LTPP may be used and programmed as any other generic Linux board. For developers who have at least some Linux coding experience, the company supplies the LTPS SDK.

Is it hard to develop native C applications for LTPS? We don't think so! If you have ever written a Linux program, it will be easy for you to figure out how to do this for the LTPP board.

Doubtful? OK, let’s see how to write a simple C application for the LTPP. Here is the list of steps: get the cross-compiler, install the SDK, build a program, and load it into the board.

----------------

Please note how the user input below is highlighted in green. Root (supervisor) credentials are NOT required for installing the SDK and building programs.

----------------

We will assume that you are using a Linux PC or that you have previously created a Linux virtual machine on your computer. If you don’t have a Linux PC yet, please install any popular Linux distribution under Oracle VM VirtualBox, QUEMU or Vmware.

Getting the Cross-compiler for LTPS From Tibbo Website

unspecified.png

*Note: the download location may change in the future. Please, search our website (tibbo.com) for updates.

Open the terminal emulator on your Linux host, make sure you are connected to the Internet, and download the LTPS SDK from http://tibbo.com/downloads/TPSL_tmp/SDK/ .

LTPS SDK Installation

unspecified (1).png

Full SDK image weighs around 0.5 Gb. It is not just a binary file; it is an installation script with an archive inside. Make it executable and run it to install the SDK.

Setting Up the Environment

unspecified (2).png

Run the environment setup script as advised by the installer.

Testing the Installation (1.1.)

unspecified (3).png

In the same terminal emulator window, try to run the GCC compiler.

Oops, this looks like the default compiler, not the compiler we want. This compiler is the GCC from your Linux distribution, and it can only build for the x86 CPU.Our cross-compiler is in the environment variables $CC, $CXX, $CPP.

Testing the Installation (1.2.)

unspecified (4).png

That is what we needed! Ok, let’s write our first LTPS "Hello World!" program and build it.

Write a Simple Program (1.1.)

unspecified (5).png

Write a Simple Program (1.2.)

unspecified (6).png

Create the "Hello World" program using any editor you like. We prefer MC (Midnight Commander) editor, but here I will use VI, just as an example.

Write a Simple Program (1.3.)

unspecified (7).png

The test_0.c source code is above.

Write a Simple Program (1.4.)

unspecified (8).png

Now create Makefile for our program. This is an old, traditional way of building anything in UNIX.

Write a Simple Program (1.5.)

unspecified (9).png

Write the Makefile...

* Lead whitespaces are not the whitespaces, they are 2 (two) tabs.

Here is the Makefile syntax.

Building Your Program With Cross-compiler (1.1.)

unspecified (10).png

Run 'make' command in the same terminal emulator window where you previously ran LTPS SDK environment setup script.

Building Your Program With Cross-compiler (1.2.)

unspecified (11).png

Program build starts from "test_0.c" to "test_0". It is an executable binary. I tried to run it but it failed with the "cannot execute binary file" message. Why? Because it was built for a non-Intel CPU.

Building Your Program With Cross-compiler (1.3.)

unspecified (12).png

Yes, you understand this correctly: we have TWO 'objdump' executables: our traditional x86 'objdump' program that can be found in the default $PATH and 'cross-objdump' from LTPS SDK that can be found in the $OBJDUMP environment variable.

First (intel) objdump says it can't detect the architecture.The second one (cross-objdump) says it is an ARM 32bit little-endian executable.Everything looks correct. Let's copy the program into LTPS and try to run it...

Success!