I'm working on an ESP-IDF based project that runs on ESP32 microcontrollers.
The project has a bunch of different C++ libraries (ESP-IDF calls them components
) I've written. Normally I compile the whole project and it gets installed on the ESP32, and everything works great.
I've been writing tests, and how I make the tests work is a little different than the standard build process. For each set of tests, I am testing just one of my C++ components. (for instance "Wireless" or "UserInputs", etc) I mock out the rest of my components and the ESP-IDF code that my code uses, and this lets me just test "Wireless", for instance.
To do this, I'm using CppUTest
and a series of makefiles. The makefile structure is based on the structure here: https://github.com/memfault/interrupt/tree/master/example/unit-testing/minimal
And here's the article I followed that is describing that makefile/testing setup. https://interrupt.memfault.com/blog/unit-testing-basics#setting-up-cpputest
So, there's a main makefile, and it finds all the per-component makefiles. Those per-component makefiles specify which .cpp
files to compile, what folders to find your imports in, where your tests are, etc. And all that works great.
The situation I'm in is that I want to be able to run the debugger in VSCode to set breakpoints, pause execution, and inspect my variables at a given point in my code.
Just doing this in the tests is enough. I don't need debugger in my main ESP-IDF build process.
But I'm having the most challenging time working with this kind of setup. Because there's not just ONE make file.
Here's the core of what I want to do. I want to be able to set a breakpoint, and then do something to tell my code to compile with a given list of .cpp
files, and header import locations. Just like in those per-component test make files. And I want my code to execute to that breakpoint and then give me the sauce in VSCode.
Any suggestions on how I can work in this direction would be very helpful.