It's been almost four years, and it's about time to revive this series on CMake and STM32 (or MCUs in general, STM32 just serves as a tangible exam...
For further actions, you may consider blocking this person and/or reporting abuse
It reminds me of a project where it was not the case at all for almost the whole codebase, it was soooo much fun (no)
Strangely enough, many people in the embedded world believe simulation is useless or even counterproductive. Sometimes, they don't even know this is possible.
Can you elaborate how we get feedback whether the tests have passed or failed from the MCU?
also, how to use ctests?
About embedded tests
It's not very easy to elaborate this topic without jumping into a particular case.
For my experience, I can tell that it is possible to use Catch2 (at least the 2.x branch) on a STM32 MCU. You need to have
printf()working (probably through a UART connected to your computer with a USB-UART cable). You need to compile a program that is small enough to fit in the ROM of the MCU and provide the compiler with the necessary functions it needs to link the program. When you power-on the board, the tests will run and the output on the UART will be similar to the output you could get while running the tests directly on your computer.About ctest
The unit tests running on the computer described in this article are of course usable with ctest. You just need to add these 2 lines to the
CMakeLists.txt:Then you can call
ctestfrom the command-line in the build directory.See the documentation cmake.org/cmake/help/book/masterin...