Dear community,
I’m trying to change the build system of my ESP8266 project from Arduino to PlatformIO core.
The board I use within the Arduino IDE is the “Generic ESP8266 module” that comes shipped with the ESP8266 Arduino Core
I wrote a custom PlatformIO JSON file for my board description that fits the settings I use in Arduino. The flash settings, method, CPU freq, etc, are supposed to be all good - and, in effect, it seemed to work at first: I can build the project, upload it to my board, and I’m also able to flash the SPIFFS using platformio run -t uploadfs
. No compilation error or anything.
However, when I try to turn on the board after flashing, the ESP displays a rapidly blinking blue light (which seems to mean panic, or so I’ve been told) outputs this about every second on the serial monitor (at 115200 bds)
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v4ceabea9
~ld
From what I could gather the rst cause:2
on the first line means a software watch dog reset. I must be doing something wrong but I can’t figure out what. Manually flashing the binary with esptool
gives the same result (Arduino-generated binary works, PIO’s do not). Flashing the SPIFFS with PlatformIO also works as expected, so it seems the problem is a compilation problem and not about flashing, etc…
When I compare the binaries generated by Arduino and platform IO, Arduino’s .bin is slightly smaller (about 20 KiB difference), and PIO’s ELF file is about 3 times bigger (1,2 MiB PIO vs. 460 KiB Arduino…)
$ ls -l build/WeatherStation.ino.*
-rwxr-xr-x 1 erwan erwan 4600587 Feb 13 10:47 build/WeatherStation.ino.elf
-rw-r–r-- 1 erwan erwan 417968 Feb 13 10:47 build/WeatherStation.ino.bin
ls -l .pioenvs/coolboard/firmware.*
-rw-r--r-- 1 erwan erwan 437344 Feb 13 02:02 .pioenvs/coolboard/firmware.bin
-rwxr-xr-x 1 erwan erwan 1211763 Feb 13 02:07 .pioenvs/coolboard/firmware.elf
Here is my board description file:
{
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"ldscript": "eagle.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "generic"
},
"connectivity": [
"wifi"
],
"frameworks": [
"arduino"
],
"name": "La COOL Board",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 4194304,
"require_upload_port": true,
"resetmethod": "ck",
"speed": 115200
},
"url": "http://www.lacool.co",
"vendor": "La COOL Co"
}
And my platformio.ini
:
[env:coolboard]
platform = espressif8266
framework = arduino
board = coolboard
lib_deps =
https://github.com/bblanchon/ArduinoJson
https://github.com/Makuna/NeoPixelBus
https://github.com/PaulStoffregen/Time
https://github.com/etrombly/DS1337RTC
https://github.com/milesburton/Arduino-Temperature-Control-Library
https://github.com/PaulStoffregen/OneWire