Programming for the Tiva C Launchpad on Linux

Posted by Strainu on February 04, 2014
Embedded

I’ve recently acquired a Tiva C launchpad from Texas Instruments, that I plan to use to complete an online course much like PM was during my faculty years. However, unlike 7 years ago, my only OS is now openSUSE, which meant having an additional (although small) challenge in creating a development environment.

Below is a checklist of what you will need. Prerequisites include being able to download and compile programs from source code (but you probably know that if you’re trying to program an embedded board, right?).

1. First and foremost, you will need a toolchain for compiling the code you write. Tiva C has an ARM Cotex-M processor, making it relatively easy to find a great number of toolchains.

Many people on the internet recommend Summon-arm, but this toolchain is no longer maintained. Instead, the author recommends GNU Tools For ARM Embedded Processors (AKA GCC ARM Embedded), so I went with that one. You can download either a precompiled archive, or the sources and do the compiling yourself. As my computer is fairly old, I decided on the binary archive:

wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2013-q4-major/+download/gcc-arm-none-eabi-4_8-2013q4-20131204-linux.tar.bz2
tar -xvf gcc-arm-none-eabi-4_8-2013q4-20131204-linux.tar.bz2
sudo cp -r * /usr

2. Then, you need the Texas Instruments libraries and headers. You will not find any Linux kit on the TI website, but fear not: the Windows installer is just a zip file that contains a working Makefile. The kit can be downloaded from this page (or direct link). You will need a TI account to download – the same one used to order the Launchpad. Compiling it is also a breeze:

mkdir tilib
cd tilib
unzip ../SW-EK-TM4C123GXL-2.0.1.11577.exe
make

3. You will also need something to download the binaries on the device. lm4flash is the recommended way of doing this on Linux. This is also compiled easily and quickly:

git clone https://github.com/utzig/lm4tools.git
cd lm4tools/lm4flash
make
sudo make install

echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | \
sudo tee /etc/udev/rules.d/99-stellaris-launchpad.rules

The last command is optional and ensures the lm4flash command can be used as a regular user. The Vendor and Product id are obtained by running:

lsusb | grep Luminary

and are the same on Stellaris Launchpad and Tiva C

You can check that lm4flash works by downloding one of the examples included in the TI archive (see step 2). After a successful download, the link should blick while the color varies.

cd tilib/examples/boards/ek-tm4c123gxl/blinky/sourcerygxx
lm4flash blinky.bin

4. Debugger – a must if you write more than very simple programs for the Tiva C. The OpenOcd package is the way to go.

If you want to fetch the source on a Deb-based Linux (Debian, Ubuntu etc.) using git, here is what you must do:

sudo apt-get install git-core libtool autoconf texinfo libusb-dev libusb-1.0 screen
git clone http://git.code.sf.net/p/openocd/cod

On my openSUSE, I prefered to download the tarball:

sudo zypper in git-core libtool autoconf texinfo libusb-dev libusb-1_0-0 libusb-1_0-devel
wget http://downloads.sourceforge.net/project/openocd/openocd/0.7.0/openocd-0.7.0.tar.bz2

In both cases, compiling is the same:

./configure –enable-maintainer-mode –enable-ti-icdi
make
sudo make install

5. While TI offers its own startup libraries, some people prefer a totally free (as in FLOSS) linker. Instructions on installing such a linker on the Stellaris Launchpad (the forerunner of Tiva C) can be found on this page. I have not tried it, as for my requirements the TI libraries are enough, but due to la similarities between the platforms, this should also work just fine on the Tiva.

This is it, you can now compile and download your own programs on your new board. However, if you’re not a vim-or-emacs person, you might want to install an IDE.

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , ,

3 Comments to Programming for the Tiva C Launchpad on Linux

  • Andrei,

    Thanks for these three article series in using the TIVA C Launchpad on Linux, I’m also on UTAustinX: UT.6.01x Embedded Systems – Shape the World and your info has been a great help for me.

    I’ll add a couple notes:
    * On debian you can use gcc-arm-none-eabi from debian repo if you also install libnewlib-arm-none-eabi from sid.

    * If you want to get openocd from git, the proper command is:
    git clone git://git.code.sf.net/p/openocd/code openocd-code

    and you have to use command
    ./bootstrap
    before ./configure

    Regards

    @mvillar

  • Strainu says:

    Thanks for the feedback Manuel! I did not need to run ./bootstrap on my setup, but I will add the info to the article.

  • Many thanks for sharing this information. Also thanks to Manuel for sharing the details about Debian.

    I’m also taking the Embedded Systems – Shape the World course at edX.org and you guys helped me a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *