Renewed start with PIO after building a new machine; best approach?

I have been using PIO for a few years now to build by controller network; mostly Arduinos with Ethernet and other libs.

I kept my projects on a separate drive.

What seems to have changed is the library location; global vs. local.

I have built a new machine, hence, have a fresh install, (same hardware architecture) and while I can open the projects, the user location ~/.platformio does, of course, not contain anything related to these projects (packages, environments, etc.)… naturally creating these errors:

The main questions are:

  1. Should I just copy the ~/.platformio directory form the old to the new machine, thus inheriting legacy locations of files?

  2. Should install these libraries through the PIO inteface and let them go where PIO decides? Would this approach correct the c_ccp_properties.json files?

  3. My biggest wish would be to have ONE directory with all the PIO related stuff, and another with the project (like I already have)… so that I can launch PIO from e.g. a laptop and work on the same files w/o any lib (or other) problems.
    The reason for this option is: I program on one desktop and prototype on another desktop (in the lab), and may upload a new firmware to a controller with a laptop. So far I grab a USB key and transfer the main.ccp and install any missing libraries on the desktop and laptop and recompile. I find this a bit cumbersome and error prone.

Any hints appreciated. Thanks.

I think if you change to that project using the project environment changer, PIO will trigger a re-init of the .vscode files and use the correct path.

Alternatively, iterate through all project folders and do a pio init --ide=vscode.

1 Like

Thanks, and sorry for being a bit thick…
Which of my three questions does this answer?

None, I’m sidepassing the questions and leading you to get rid of those intellisense errors the way I assume it should be done.

:slight_smile: OK…
But what about the libraries that are truly missing?
See image three lines down from the blue… it points to lib/Onewire.
I do not know, whether this is the spot where this lib would go to if I install it.

Given this is a clean install (I am only pointing to a project directory elsewhere) and am thinking along the three questions. One is is the proper way; the other is there a chance for a set-up than I can point to a networked project directory and code from three machines?
If the latter is not feasible or breaks things, then I rather install the proper way (as in keep stuff where it has to go), rather than fiddling with it.

Does that project build when you switch to it and press build? If it is missing the library after that, that’s a real problem. Before that I just assume the Intellisense is not updated or the dependencies are not yet downloaded.

I should update my post and put in bold “I built a new machine”… (done)

CLIpio platform install --with-all-packages atmelavr → repeat with other platforms (ststm32, espressif32, espressif8266, atmelsam, …).

Otherwise you can truly copy over your older packages/ and platforms/ folder 1:1 to the new machine. (If they’re same OS and CPU architecture type, like x64, otherwise don’t copy over the tool-... and toolchain-.. folders, the rest yes.)

Yes, same architecture…

The main reason I ask is, because of the organic growth of PIO over the years… libs (if I am not mistaken) were in global folders, now these are local (per project).
So I have a mix of these, and rather clean up now.
However, I think others would have a separate project folder too. If the new way is to store the libs with the projects, then the local ./platformio directory would not have any. (I could be wrong.)

Then you need to ‘rescue’ these too if they were in <home folder>/.platformio/lib if you don’t want to rewrite the platformio.ini.

From what I’ve read from ivankravets, global libraries are indeed frowned upon and the GUI installation of global libraries has been removed. I don’t however think they will be removed from the core functionality. And essentially, pointing lib_extra_dirs to some folders where you have project-shared libraries is doing the same thing as global libs.

1 Like

Thanks for your time…
I think I am starting to ‘get it’… it seems installing the libs through the GUI and then updating the platform.ini files seems the way to go.
I am all for consistency, hence, this seems a good way forward…
The only exception are libraries not available through the GUI, and I am happy to put them in a central directory and point to it via lib_extra_dirs.