How do I use PlatformIO to flash ESP-12F (ESP8266MOD)

In PlatformIO while creating a project , in the board selection there is no ESP-12F in the boards. While there is ESP-12E. I can flash ESP-12F while choosing ESP-12E from the boards without any flashing issue. But there are some runtime issues, the one that I noticed is the LED doesn’t blink when flashed from PlatformIO , but works fine, when flashed using Arduino IDE using the same code. So there may be some difference in the configurations.

C:\Users\USER.platformio\platforms\espressif8266\boards

In this directory I found the esp-12e board which is a JSON format.

{
  "build": {
    "core": "esp8266",
    "extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12",
    "f_cpu": "80000000L",
    "f_flash": "40000000L",
    "flash_mode": "dio",
    "ldscript": "eagle.flash.4m1m.ld",
    "mcu": "esp8266",
    "variant": "nodemcu"
  },
  "connectivity": [
    "wifi"
  ],
  "frameworks": [
    "arduino",
    "simba",
    "esp8266-rtos-sdk",
    "esp8266-nonos-sdk"
  ],
  "name": "Espressif ESP8266 ESP-12E",
  "upload": {
    "maximum_ram_size": 81920,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "resetmethod": "nodemcu",
    "speed": 115200
  },
  "url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family",
  "vendor": "Espressif"
}

How do I add ESP-12F to the PlatformIO boards and flashing without any issue.

It’s most likely the onboard LED is on GPIO2, not GPIO1 so try adding

build_flags = -D LED_BUILTIN=2

to your platformio.ini … hopefully that kicks in before the pins_arduino.h defintion.

No, It doesn’t work.
And the compiler throws a bunch of warnings.
What I did to make it work is to ignore LED_BUILTIN constant and use 2 instead.

Very likely redefinition of macro... because there two #define LED_BUILTIN with mismatching values.

If LED_BUILTIN should work out-of-the-box then a new ESP12F target should be created. You can open an issue on Issues · platformio/platform-espressif8266 · GitHub for it.

2 Likes