PlatformIO Community

Automatic sequential compilation of dozens of projects

Good afternoon.

Can you please tell me how can I compile a dozen or two dozen PlatformIO projects at once, one after the other, without having to load them into VSCode?

Now I already have many projects for ESP32 + ESP-IDF written with PlatformIO. All of them use my own libraries. When making even tiny changes to one of the libraries, it becomes necessary to recompile all projects.

The trouble is that PlatformIO is just very terribly terribly terribly very, very, very slow. Even on Core i7 and SSD. After opening the workspace, it takes about 5 minutes to load tasks, update indexes and other garbage.

As a result, the manual recompilation process looks like this:

  1. Open project 1
  2. Let’s go drink tea for 10 minutes
  3. Compile (5 more minutes)
  4. Upload the file to FTP (well, it’s easy and simple to do with a batch file)
  5. Open project 2… repeat steps 1-4.

As a result, the whole process takes a couple of evenings and there is a strong desire to curse the PIO developers.

QUESTION FOR THE EXPERTS:

How to automate this process using a batch file, preferably without opening VSCode at all. That is, I need to create such a bat, which, when given the project directory, would collect it. And I can send it to FTP.

If PlatformIO is in your path. Pressing the build button is the same as running pio run in the project directory. That can be put in the batch file and will result in a predictable binary path for the .bin and .elf file as .pio/build/<environment name>/firmware.bin. That can then be copied to the FTP root on the local disk or a remote server.

I’ve never had a re-indexing operation take 10 minutes, this seems extreme.

5 minutes of compilation time seems reasonable to me with the ESP-IDF SDK, which has a gargantuan size with a billion files – this one is on Espressif. PlatformIO already does the best it can with parallelization of compile jobs across all CPU threads.

I found a way last night. It turns out it wasn’t very difficult. pio run will save me i think

image

Yes, I also found this same command. I should have just done pio -h right away, and not searched the Internet

PlatformIO does not depend on VSCode. You can do everything from the command line. And then script and automate it to you heart’s content.

I don’t have VSCode installed. I tend to develop using lots and lots of small main apps (see Here is a simple way to have many small "main" apps) and in fact often fire up a background script which watches for file changes and automatically re-compiles, re-uploads, and re-runs specific apps while editing. With auto-save in an editor, all it takes is switching window focus, which is part of the normal workflow anyway. I call it Continuous TDD, but no doubt many others have done the same thing.

I don’t really understand how anyone can move cursors and push buttons all day long, or press the same series of key combinations over and over again.

Thanks. Yes, that’s exactly what I did - I wrote the script. All I needed was pio run. To be honest, I didn’t expect it to be so easy. Now I have written two bat files, one of them compiles the project and uploads bin to the server for remote updating, and the second one simply calls the first one for each of the projects. If anyone is interested, I can share.
PS: Now compilation is a pleasure!!!