TDD for Microcontrollers: A practical test-first approach

Speaker: Daniel Penning

Audience level: [ Beginner | Intermediate | Advanced ]

With test-driven development, you first write a test and only then begin with the implementation.
Studies show that this approach reduces both the development time and the error rate.

For that reason, TDD is (at least partly) practiced in a lot of C++ projects. However embedded C++ projects with a lot of hardware-dependend code can traditionally not employ TDD in a straight-forward way.

The presentation shows how the TDD approach can be effectively applied to microcontroller-based projects.
To this end, the dual-target approach developed by James Grenning will first be presented. However, for hardware-related code, such as drivers, this approach has limitations that are not practical.

In the talk, dual targeting is therefore supplemented by open loop tests. The external microcontroller interfaces (GPIO, CAN, I2C, ...) are conceptually replaced by mocks and stubs known from the unittest.
With this addition, a practical embedded TDD workflow is created.
The advantages of test-driven development can then be used for the complete microcontroller development.

Questions that will be anwered in this talk

  • Why does TDD bring enormous benefits for embedded development in particular?
  • How can a dual-target approach be built based on open source solutions?
  • What advantages do commercial solutions offer?