CLION "Nothing to run on"

I have a project with platformio + clion working great on my laptop. I moved the project over to another computer (via VCS - really I just checked it out at a second location) and I am back to a familiar place: “Nothing to run on”

image

I think I did everything in the guide. I created a profile in “Build Execution & Deployment” / “Cmake”, re-initialized the pio project, everything I could find in that guide.

Neither the working nor non-working ones have a “Custom Build Target” defined.

I think “Nothing to run on” is really telling me it’s missing a “target” but I’m not sure where to set that.

What am I missing?

1 Like

What’s the content of your platformio.ini?

I define two environments:

[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino

[env:feather32u4]
platform = atmelavr
board = feather32u4
board_build.mcu = atmega32u4
board_build.f_cpu = 8000000L
framework = arduino
build_flags = -D BLUEFRUIT
lib_deps = Adafruit BluefruitLE nRF51@^1.9.6
  SoftwareSerial@1.0

I don’t have a [platformio] section where I define a default. I tried that, and it didn’t seem to make a difference - and on my other instance of clion I don’t have that and it works anyway. I’m not entirely sure what’s up with that.

I did make a tiny bit of progress, though. I created a ‘Production’ run configuration, which is a cmake target. That actually did what it was supposed to, and it recognizes that there are two possible targets - feather32u4 and adafruit_feather_m0.

image

note that it found the two targets I defined in platformio.ini (which makes sense, because those are the two targets that got generated and put into the generated CMakeLists.txt)

That’s great … but there’s still something missing. When I select PlatformIO Upload it still says “Nothing to run on.” So there’s still something missing here, something to signal to PlatformIO which target (m0 or 32u4) it should use. I don’t know how to give the PlatformIO targets “something to run on.”

Can you show a screenshow of how the Preferences → Build, Execution, Deployment → CMake configuration looks like? Especially looking at CLion — PlatformIO latest documentation, it says that sometimes manual creation of these profiles is needed. I only see a configuration “Production” in your screenshot if I interpret it correctly.

I can. But read below, I think I figured something out.

I think I figured out two things are required here:

  1. You really do need he Z_DUMMY_TARGET target
  2. After you create that target, and set it to “Production”, you need to DELETE the PlatformIO debug and upload run/debug configuration, then create a new one. For some reason you seem to have to do that step manually.

For a while I had a target named “Production” but I looked at the CMakeLists.txt that got generated by pio init and it includes this at the end:

add_executable(Z_DUMMY_TARGET ${SRC_LIST})

I had come across that dummy target once before but I didn’t dive into figuring out what it was / why you needed it. When you generate a brand new project with clion file / new project / platformio, it seems to generate Z_DUMMY_TARGET but if you fool around adding/deleting/moving stuff and you lose that target then everything works fine until you try to generate PlatformIO Upload.

I don’t understand PlatformIO enough to know what’s going on here, but since this is the internet let me recklessly speculate: when you add that PlatformIO Upload run configuration, it seems to look for the available targets specifically named Z_DUMMY_TARGET … why I couldn’t tell you.

What I’m trying to figure out is whether this is a platformio problem, a clion problem, or is it neither and it’s just my confusion?

I still cannot get past this problem. I somehow fixed it on one of my projects, but I can’t share it. What I am working on now I can share, though.

https://github.com/wz2b/platformio-test

I created a dummy project there, It exhibits this same problem:

image

“Nothing to run on”

I was fairly convinced the problem was in the CMake profile configuration, but I have two projects, both have profiles set up the same way. In the one that works, the above menu looks different - it has checkmarks showing the targets.

That item with the checkbox is not a ‘configuration’ at all. What is it? I think that’s the real issue here.

If anybody has experience with clion and platformio, maybe you can git clone the above and let me know. I’m using clion 2020.1.3 and the latest jetbrains platformio plugin (201.8743.17) and PlatformIO 5.0.4b1

Thank you!!

Works all fine here. I re-initialized the project on the commandlne (pio init --ide=clion), opened the project in CLion and then added the CMake targets for the the adafruit board.

Double check that in the Settings → build, Execution, Deployment → CMake looks like

Are there any errors when you right click on the project and do a “Reload CMake Project”?

Nope.

“C:\Program Files\JetBrains\CLion 2020.1.1\bin\cmake\win\bin\cmake.exe” -DCMAKE_BUILD_TYPE=adafruit_metro_m0 -G “CodeBlocks - MinGW Makefiles” C:\work\milli\sunspec-milli
– Configuring done
– Generating done
– Build files have been written to: C:/work/milli/sunspec-milli/cmake-build-adafruit_metro_m0

[Finished]

Good, because that’s what I get, too.

“C:\Program Files\JetBrains\CLion 2020.2.4\bin\cmake\win\bin\cmake.exe” -DCMAKE_BUILD_TYPE=adafruit_metro_m0 -DCMAKE_C_COMPILER=C:/Users/Max/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe -DCMAKE_CXX_COMPILER=C:/Users/Max/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++.exe -G “CodeBlocks - MinGW Makefiles” C:\Users\Max\Desktop\platformio-test-main
– Configuring done
– Generating done
– Build files have been written to: C:/Users/Max/Desktop/platformio-test-main/cmake-build-adafruit_metro_m0

Does Tools → PlatformIO → Build now run?

Fixed that by manually removing build configurations (platformio upload & debug). Then ensured I already have targets coming from platformio.ini. Then added build configurations. In my case problem was that I added build configurations before adding correct targets. Hope this helps someone

1 Like

At the end I was able to solve it… what I have done…

  • When CLion starts it asks if you want to convert to the “new project”, answered yes
  • Removed CMakeListsUser.txt and CMakeLists.txt
  • Removed the backup file folder that CLion creates when converting the project
  • Added a CMake configuration that targets “All targets”

Now if I select that configuration, I can build all, clean all, upload all targets by double clicking the corresponding action in the platformio tab.

Love this new enhancements since you can now “Upload and monitor”, finally.