Wrong board name for Arduino boards


I’m contributing to a framework being built upon Arduino ESP8266 core.

We’ve limitation to support PIO users in terms of using ARDUINO_BOARD macro.

There’s a noticeable difference between ARDUINO_BOARD being compiled by Arduino IDE vs PIO.

Let’s explain it by an example : using ESP8266 NodeMCU via Arduino IDE yields ESP8266_NODEMCU (look at esp8266 boards.txt) . but using PIO yields PLATFORMIO_NODEMCUV2.

Tried using build_unflags , build_flags but ARDUINO_BOARD never changed, while compiling I got this warning :

:0:0: warning: "ARDUINO_BOARD redefined [enabled by default]
:0:0: note: this is the location of the previous definition

How could it be solved ? Would that lie in PlatformIO build system ?

1 Like

As you can see in

the board value is used in the creation of the macros

 -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}"

but PIO defines

So that’s where the PlatformIO prefix comes from. However, the board still defines all other macros

So -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU are all still here

Thanks for letting me know where PlatformIO prefix came from.
Additional note : It doesn’t copy the correct arduino build.board. It copies the PIO board ID.

And yes, the board type is correctly defined.

But how the board name issue can be solved?