Practice writing code without the hardware

For most of my time as an embedded software developer, I almost exclusively wrote code that was going to be run on some microcontroller. I'd fire up the IDE, crank out some code, download (this often took a couple minutes) an run. Then I'd somehow try to figure out if what I had written was correct.

Read More

Event-based interfaces for testability

Unit testing is great for verifying the behavior of individual modules, but how do you put those modules together in a way that makes things testable?

One of the most useful ways I've found to do this is to think about the system in terms of events.

Read More

Getting Started with Ceedling [3/3] - Building a release binary

This is the third of a three video series to show how to quickly get started with Ceedling for test driven development in C -- by test driving a simple "FizzBuzz" example.

In the previous video we test drove a simple example -- writing the tests along with the code.

In this video we look at how to use Ceedling to build a release binary (it's pretty easy!).

In this example we used native GCC to compile for our host platform, but you can could the release_compiler setting in the project.yml file to compile for whatever target you want.

I hope you enjoyed this quick intoduction to test-driving embedded software with Ceedling. If you're new to unit testing or test driven developement, Ceedling is a really great way to get started. In just a few minutes we were able to create a new project and develop a high quality, well-tested FizzBuzz implementation.

Getting Started with Ceedling [1/3] - Creating a new project

This is the first of a three video series to show how to quickly get started with Ceedling, by test driving a simple "FizzBuzz" example.

In this video we introduce our example problem, create Ceedling project, create a source code module (easily using Ceedling!) and look at how to run the tests.

Read More

Changes to Ceedling - no more rake

Have you tried to use Ceedling recently, but got this error when you tried to run rake?

No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
Read More

Unit testing with flash (EEPROM)

Do your embedded applications ever save any data to flash memory (aka EEPROM)? This where you typically store non-volatile information that needs to preserved if the device is powered down.

This sort of thing is tough to test in the traditional way -- by loading code onto the target and running it -- because it's hard to set and _re-set_ the data in flash for testing. It can also be harder to inspect the data when it's in flash memory.

Read More

Designing firmware from the inside out

I don't know about you, but a very natural way for me to think about designing embedded software is from the "outside in". I've been thinking about this a bit recently, and I'm not so sure that's the best approach.

Read More

When you want to unit test... abstract the hardware

So you write embedded software in C and you think that unit testing might help you do it better. You already know about creating well-defined software modules and how this makes it easier to write unit tests. But what else can you do to make these modules easier to test? What are some more coding patterns that make unit testing easier?

Read More

For embedded TDD, don't worry so much about testing on the target

If you want to do embedded test-driven development (TDD), running your automated unit tests on the target is too slow. When you're test-driving, you're running the tests very frequently. You will not want to wait for the tests to download to the target. It will disrupt your flow and you'll get more easily distracted.

Read More

CMock vs FFF - A Comparison of C Mocking Frameworks

Did you know you have options when it comes to creating mocks for your C-language unit tests?

I've been spending a lot of time working with CMock -- since it's used by Ceedling -- but I've just been checking out FFF (the "fake function framework"). It's well done and I think it deserves a closer look.

Read More