This article is part 3 of a series. Return to part 1 here: https://uncannier.com/unit-testing-of-embedded-firmware-part-1-software-confucius/
In the last article (https://uncannier.com/unit-testing-of-embedded-firmware-part-2-x86-build-cpputest-simplicity-studio-thunderboard/), I created an x86 build of the Uncannier Thunderboard embedded firmware and unit tests. In this article, I’ll cover how to execute the unit tests on-host, thus allowing Test Driven Development (TDD) to be performed on-host. This will involve adding x86 run support to Simplicity Studio. I’ll also cover how to get x86 GDB going in Simplicity Studio, so you can debug your code and unit tests.
As Simplicity Studio is a YACE (Yet Another Customized Eclipse), the instructions in this article will apply to just about any YACE, such as Atollic Studio, CodeWarrior, etc. This article uses the Uncannier Thunderboard projects as the example, of course.
Simplicity Studio Escapology
Did you ever want to be a magician or escape artist? Vendors love to lock down lots of useful Eclipse CDT features because, obviously, we can’t be trusted to know how to use them. Escaping a vendor YACE lock down is your big chance to be exactly like Gob Bluth during his prison escape illusion, but without the huge mistakes.
In part 2 I showed you how to enable x86 builds in Simplicity Studio. Now I show you how to enable x86 executable running and debugging.
Out of the box, Simplicity Studio offers a Debug button on the toolbar, but the stock Eclipse Run button is absent. Let’s turn it on.
Window->Preferences->General->Capabilities and then enable Platform Run Actions.
Now the Run button is available on both the C/C++ perspective and the Simplicity IDE perspective.
Local C/C++ Application Type (x86 Type)
Out of the box, Simplicity Studio only supports running and debugging build configurations of Silicon Labs ARM Program type. And thus it only supports running and debugging embedded ARM programs on target. If you click the drop-down arrow next to either the Debug or Run buttons on the toolbar, you will only be offered Silicon Labs ARM Program. Likewise if you right click a project and select Run As or Debug As.
Time for my next trick.
Window->Preferences->General->Capabilities and then enable CDT – C/C++ Standard Launch Configurations.
Now look in your pocket and you’ll find a 9 of hearts. Oh wait. No. You now have Local C/C++ Application as a run configuration type.
A run configuration of Local C/C++ Application type can now be created.
At this moment you can run the configuration to execute your x86 unit test executable within Simplicity Studio. Thus the output is seen on Simplicity Studio’s Console view.
If you think that, with a run configuration now working, it would be easy to get a debug configuration working, you’d be wrong. If you try to debug using that configuration, you get a charming error like this.
To solve this, we need to install a CDT plugin because Simplicity Studio lacks integration of the x86 GDB debugger out of the box.
Restore The Install New Software Option
Silicon Labs, in their infinite wisdom, have removed the Help->Install New Software… option present in every Eclipse or other YACE I’ve ever seen. Upon discovering this, I channeled a Gob Bluth “Come On!”.
Fortunately, what can be done, can be undone.
Window->Preferences->General->Capabilities and then enable Platform Install Commands.
And thus it is restored.
Add Eclipse CDT As A Repository
Help->Install New Software… and add Eclipse CDT as a repository.
Install CDT Standalone Debugger Support
Help->Install New Software… and install the CDT Standalone Debugger Support package.
Now Simplicity Studio has the package it needs to start x86 GDB when a Debug session is launched.
The absence of x86 capabilities in Simplicity Studio is disappointing. Sadly it’s not unique; I have had similar struggles with CodeWarrior in the past. Fortunately it’s not hard to turn the features back on.
Conquering Simplicity Studio makes me feel like Gob Bluth that time when he surprised himself with his successful disappearing yacht illusion. Yes, I know that’s very tenuous, but I really want to link to this video.