PlatformIO Community

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?

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 https://docs.platformio.org/en/latest/integration/ide/clion.html#clion-does-not-load-project-build-environments-from-platformio-ini, 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.

image

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?