Skip to content

Arduino IDE compiling differently that PlatformIO, causing bugs in ESP8266 #83

Closed
@mamama1

Description

@mamama1

Configuration

Operating system: Windows 10 64 Bit

PlatformIO Version (platformio --version): PlatformIO, version 3.5.3a8

Description of problem

I've got a pretty big (around 4k lines) software written for the ESP8266 (WiFi LED dimmer) which seems to compile differently between Arduino IDE and PIO.
The firmware has two TCP servers. One is a webserver and based on the ESP8266WebServer.h and the second one is a simple tcp server which listens to incoming bytes and is based on the ESP8266WiFi.h (class WiFiServer and WiFiClient).

When compiling the software using the Arduino IDE, everything works as expected. When compiling the same software with PIO, the tcp server which is based on ESP8266WiFi.h stops working after serving one request. The webserver and the rest of the devices continues working. However, also Wifi connection issues occur, like SoftAP not working (SSID doesn't show up).

I have reproduced this many times, it occurs using any ESP8266 core version beginning with 2.2.0 when I use PIO and does NOT occur on any Arduino compiled ESP8266 core, also beginning with 2.2.0 including 2.4.0-rc2.

I can't isolate the issue so I guess it will be hard to track this one down using the code. Rather, maybe it would be possible to somehow match the compile options of the Arduino IDE and PIO? Something stuff-breaking must be different here?!

I "converted" the Arduino .ino project this way:

  • copy .ino content to main.cpp
  • change order of functions so that no functions are called which aren't declared yet - arduino ide doesn't seem to care about the order
  • put setup and loop to the end of the file

The content of platformio.ini:

[env:nodemcuv2]
platform = espressif8266@1.6.0
board = nodemcuv2
framework = arduino
monitor_baud = 115200

There is an addin for Visual Studio, called "VisualMicro" which had a very(!) similar or even exact the same issue. I contacted the developer and after sending him the build logs and a few months he said that there was something wrong with the linking order or something and now it seems to be fixed.
So I don't think that this is an error on my side, although I wouldn't be opposed to that if it were so.

Please help, i think PIO is REALLY cool stuff, but this is really stuff breaking and I can't even use it as an IDE and all the cool lib manager/dependency features because the Arduino IDE can't compile PIO stuff.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions