• Articles
  • Ceedling Book
  • Eclipse Toolkit
  • About
Menu

ElectronVector - Test-First Embedded Software

Better embedded software
  • Articles
  • Ceedling Book
  • Eclipse Toolkit
  • About

Get your free guide: How to use Ceedling for embedded test-driven development

A Test-Driven Development Environment for the Tiva C Series Launchpad

July 29, 2015

Get the source on GitHub

For embedded test-driven development in C, you need to use a unit test framework to make testing easier. This can take some work to set up. I've created a reproducible environment with Vagrant that you can start using in just a few simple steps.

At some point, though, you'll need to download to some real hardware. That's why this environment supports the TI Tiva C Series Launchpad board (EK-TM4C123GXL). You can build and load to the target from this environment.

The Tiva C Series Launchpad (EK-TM4C123GXL) is a low-cost evaluation board from TI for their powerful line of ARM Cortex-M4F-based microcontrollers. You can get it for about $13.

Requirements

This build environment requires that Vagrant and Virtualbox are installed. Virtualbox 5.0 is supposed to add support for USB 3.0, but I've only been able to get this environment program to the Launchpad board when it's connected to a USB 2.0 port.

It's Go Time

  1. Get the source. Either clone with git (https://github.com/ElectronVector/tiva-launchpad-tdd.git) or download.
  2. Start the environment with vagrant up.
  3. Log in to the environment with vagrant ssh and switch to the example project folder with cd example-project.
  4. Run the unit tests with rake test:all.
  5. Load the program onto the Launchpad over USB with rake load.

The LED on the Launchpad should flash between red, green and blue.

How it Works

This is a Linux environment hosted by Virtualbox and configured with Vagrant. When you first create the environment, Vagrant installs and configures everything we're going to need, including:

  • The GCC ARM Embedded Cortex-M4 compiler from ARM.
  • The Ceedling unit test framework.
  • The lm4flash flashing utility.

Ceedling is used for unit tests. It compiles the tests with the native GCC compiler and runs them in the Linux host environment for speed.

Ceedling is also used to build the target binaries. It has been configured to use the GCC ARM Embedded compiler for this.

A custom Rake task (load) has also been added to do the flashing of the Launchpad board with lm4flash.

For more details, check out the repository on GitHub.

← Why I Like to Write the Tests FirstPortable, Reproducible Embedded Build Environments with Vagrant →
Matt Chernoksy

Matt Chernosky


book-3d.png

Need more help with Ceedling?

A Field Manual for Ceedling is filled with examples for how to write tests (and create mocks) for your embedded software.

Get the Book

Add unit tests to your current project with Ceedling

Try embedded TDD right now with Ceedling

Mocking embedded hardware interfaces with Ceedling and CMock

CMock vs FFF -- A comparison of mocking frameworks


Don't miss a post!

Sign up here and I'll keep you in the loop.

ElectronVector