Introduction: Tibbo LTPS Native C Development How To

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.

Step 1: Getting the Cross-compiler for LTPS From Tibbo Website

*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/ .

Step 2: LTPS SDK Installation

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.

Step 3: Setting Up the Environment

Run the environment setup script as advised by the installer.

Step 4: Testing the Installation (1.1.)

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.

Step 5: Testing the Installation (1.2.)

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

Step 6: Write a Simple Program (1.1.)

Step 7: Write a Simple Program (1.2.)

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.

Step 8: Write a Simple Program (1.3.)

The test_0.c source code is above.

Step 9: Write a Simple Program (1.4.)

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

Step 10: Write a Simple Program (1.5.)

Write the Makefile...

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

Here is the Makefile syntax.

Step 11: Building Your Program With Cross-compiler (1.1.)

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

Step 12: Building Your Program With Cross-compiler (1.2.)

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.

Step 13: Building Your Program With Cross-compiler (1.3.)

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!

Comments

author
seamster (author)2016-05-25

Interesting stuff, thank you for sharing.

author
Dmitry_Dvorkin (author)seamster2016-05-25

Thanks. I was trying to make it easy and understandable.