PlatformIO Community

Multiple boards with --ide option?

I’m wondering about the feasibility, or wisdom, of initialising a project with the -ide option (codeblocks) and more than one board? For example:

pio init --ide codeblocks --board uno --board nanoatmega328

I have tried this but the codeblocks project file created has two targets, debug and release, and running a build compiles both boards. I didn’t try an upload (via the run option in CodeBlocks) as the commands in the project file don’t determine an environment (-e option) so I assume the final code uploaded to whichever device was plugged in, would be the final code compiled - and not necessarily the correct version.

I would expect (!) that there would be a target for uno and another for nanoatmega328. It appears that the dubug and release targets use the same command lines to compile, clean etc - so there’s no need to have both (in my opinion) unless other boards do have a separate debug target.

I also noticed that one of the compiler defines, ARDUINO_AVR_UNO, is the only board mentioned - so this might be a bit of a problem perhaps?

So I edited my project file and created a target for uno and one for nanoatmega328 where I simply added the -e uno or -e nanoatmega328 options to the appropriate command lines, after the run command. It seemed to work in the IDE, but I’m suspicious of that ARDUINO_AVR_UNO define that appears to always be passed. It’s fine for the Uno, but is it ok for the Nano I wonder?

Failing all of the above, I would suspect that the pio init --ide ... command should check for one and only one target board?

This is all on the latest 4.1.0 release.

Cheers,
Norm.

1 Like

Currently, it’s impossible with a classic project generator. We will need a native PlatformIO extension that can manage multiple build environments, the same as PlatformIO IDE for VSCode does.

Ok, thanks Ivan.

Cheers,
Norm.