This is obviously an avr tool chain error, so I would guess switching them would be in order.
At the head of my cpp file is the following
#ifdef IS_D1
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#else
#include <Arduino.h>
#endif
For the Wemos D1, I have a “build_flags = -D IS_D1” in the env entry in the platformio.ini. Compiles work as expected. As a test, I force an error in the line "#include lalala <Arduino.h>"
and compiles without error.
When I compile for the uno (IS_D1 not defined), I go down the rabbit hole with an error that shouldn’t happen.
…
Archiving .pioenvs\uno\libFrameworkArduino.a
Compiling .pioenvs\uno\lib\WiFi\utility\spi_drv.o
Compiling .pioenvs\uno\lib\WiFi\utility\wifi_drv.o
Indexing .pioenvs\uno\libFrameworkArduino.a
Archiving .pioenvs\uno\lib\libWire.a
C:\users\Peter Carter\.platformio\packages\framework-arduinoavr\libraries\WiFi\src\utility\spi_drv.cpp:21:17: fatal error: SPI.h: No such file or
directory
#include <SPI.h>Indexing .pioenvs\uno\lib\libWire.a
^
compilation terminated.
*** [.pioenvs\uno\lib\WiFi\utility\spi_drv.o] Error 1
…
With an uno, SPI and WiFi should not even be needed. Although this is a genuine file error, it should not have been triggered with this compile. I use WIRE, but not SPI or WIFi.
If I use the following on the uno
#ifdef IS_D1
//#include <ESP8266WiFi.h>
//#include <ESP8266mDNS.h>
//#include <WiFiUdp.h>
//#include <ArduinoOTA.h>
#else
#include <Arduino.h>
#endif
The uno compiles fine. Go figure
If I use the following on the uno…
#ifdef IS_D1
#include la la la <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#else
#include <Arduino.h>
#endif
It does not error out on the “la la la”, but it does suffer from the same compile error above.
So, the logic of compiles (in avr) seem to be ok, but what ever makes decisions on what else is needed to compile is flawed.
My mbed, simba and esp8266 compiles all work as expected.
Lost a few days trying to figure out what was wrong.