I’ve started working on a STM32F103 board using the CMSIS framework and a ST-Link/V2 probe.
I’ve been using CLion as an IDE and was able to debug my code using the ST-Link probe. After trying out other IDEs (Eclipse CDT, STMCube…) I returned to CLion and now the PlatformIO/Debug target stopped working (both when ran from CLion or from the commandline) and returns:
*** Do not know how to make File target `debug’ (/path/to/project/debug). Stop.
[FAILED] Took 0.37 seconds
make[3]: *** [CMakeFiles/Debug.dir/build.make:70: CMakeFiles/Debug] Error 1
make[2]: *** [CMakeFiles/Makefile2:113: CMakeFiles/Debug.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:120: CMakeFiles/Debug.dir/rule] Error 2
PlatformIO/Upload continues to work and I’ve managed to debug the program running ‘platformio debug --interface=gdb -x .pioinit’ in the command line.
and the custom targets in the CMakeLists.txt is the auto generated one reading:
add_custom_target(
Production ALL
COMMAND platformio -c clion run “$<$<NOT:$CONFIG:All>:-e${CMAKE_BUILD_TYPE}>”
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(
Debug ALL
COMMAND platformio -c clion run --target debug “$<$<NOT:$CONFIG:All>:-e${CMAKE_BUILD_TYPE}>”
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
I was just about to open an issue because I get the same error in Windows + CLion 2021.2.
"C:\Program Files\JetBrains\CLion 2020.2.4\bin\cmake\win\bin\cmake.exe" --build C:\Users\Max\Documents\PlatformIO\Projects\clion_debug_test\cmake-build-genericstm32f103cb --target Debug -- -j 12
Processing genericSTM32F103CB (platform: ststm32; board: genericSTM32F103CB; framework: cmsis)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103CB.html
PLATFORM: ST STM32 (14.2.0) > STM32F103CB (20k RAM. 128k Flash)
HARDWARE: STM32F103CBT6 72MHz, 20KB RAM, 128KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
- framework-cmsis 2.50501.200527 (5.5.1)
- framework-cmsis-stm32f1 4.3.1
- tool-ldscripts-ststm32 0.1.0
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
*** Do not know how to make File target `debug' (C:\Users\Max\Documents\PlatformIO\Projects\clion_debug_test\debug). Stop.
========================== [FAILED] Took 1.21 seconds ==========================
mingw32-make[3]: *** [CMakeFiles\Debug.dir\build.make:69: CMakeFiles/Debug] Error 1
mingw32-make[2]: *** [CMakeFiles\Makefile2:112: CMakeFiles/Debug.dir/all] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:119: CMakeFiles/Debug.dir/rule] Error 2
mingw32-make: *** [Makefile:136: Debug] Error 2
But then I decided to read the documentation regarding this paragraph that says
Remove pre-task (“Build”) from PlatformIO Upload and PlatformIO Debug configurations to avoid double project building. You should see “There are no tasks to run before launch”.
Thanks for the reply. I can confirm that it also works in my system and can debug the code.
After further investigation, I see that the problem is that it fails when trying to build the project while the debug target is selected. I don’t remember this being the case before and it doesn’t happen when I tried an equivalent project using Visual Studio Code (also in Linux). I feel it is more a workaround than a fix to the underlying problem.
I’ve hit this recently too, I originally thought it was a clion bug (see https://youtrack.jetbrains.com/issue/CPP-26736 where I fully documented the behaviour with logs and versions). However, on reflection, I don’t think it’s a clion issue because it builts perfectly and repeatedly with 5.1.0, and then never works on 5.2.0. Same version of Clion.
I originally removed the build task option in clion, but I think that causes subtle problems too, but it was so long ago that I will try it again and report back if I see any issues from doing so.
I’m running CLion 2021.3.2 on Mac with Monterey 12.1 and platformio 5.2.4 installed from homebrew and pip and the getPlatformio.py script. When I do a buid from the Tools/Platformio menu, I get *** Do not know how to make File target `debug’ (/Users/jbasiago/Development/C++/LayoutSurveyor/debug). I’ve run the commands you listed last from the terminal in CLion, then restarted Clion and I still get the debug message. I am able to build the project using the build button on the configuration options. I’ve been using CLion with platformio for about a year and never had these problems before. Today I ran into some build issues and had to reinstall and upgrade platformio. I’m still able to work, but this feature use to work.
I’m facing the same issue for a second day now. The project was working before I changed to the different board.
I took every proposed steps multiple times. I’ve reinstalled PlatformIO, regenerated CMakeLists/Private.txt files, removed and cretaed .pio and .cache and reinitiated pio project with no luck.