Unable to compile for ESP8266 [RESOLVED]

I’ve been quite happily playing around with the ESP8266. Today I tried to compile my latest efforts and got a load of errors. A quick investigation showed that the selected board under board manager had changed to Arduinio Zero. That explained all the errors.

I tried to change it back to generic ESP8266 and discovered that all ESP8266 boards have disappeared from board manager.

I have updated to the latest version of the IDE.

I have gone to preferences and checked that the 2 additional board URLs I was using are still there (they are)

https://raw.githubusercontent.com/dabshield/WeMos/master/package_wemos_index.json
http://arduino.esp8266.com/stable/package_esp8266com_index.json

I have gone to board manager, searched for ESP and found ESP8266 by ESP8266 community and installed that, however, the latest version 2.5.1 won’t install so I have 2.5.0 installed.

I have selected generic ESP8266 module (same as I had before, which worked just fine) and tried to compile. Now I get

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Perry Bebbington\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=512K,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -vid-pid=10C4_EA60 -ide-version=10809 -build-path C:\Users\PERRYB~1\AppData\Local\Temp\arduino_build_295131 -warnings=all -build-cache C:\Users\PERRYB~1\AppData\Local\Temp\arduino_cache_69368 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-3-20ed2b9.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9 -prefs=runtime.tools.esptool.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9 -prefs=runtime.tools.esptool-2.5.0-3-20ed2b9.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-3-20ed2b9 -prefs=runtime.tools.mkspiffs-2.5.0-3-20ed2b9.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-3-20ed2b9 -verbose C:\Users\Perry Bebbington\Documents\Arduino\Test\ESP8266_NTP_clock_test_21\ESP8266_NTP_clock_test_21.ino

Board generic (platform esp8266, package esp8266) is unknown

Error compiling for board Generic ESP8266 Module.

Apart from the changes I have mentioned above, this is code that compiled perfectly well this morning.

Help and suggestions please.

Thanks.
EDIT: See reply #6.

Please, post your sketch so that I can check if it is compiled in mu ESP8266/NodeMCU.

Attached as it is too big to copy and paste. Please understand there is a lot of junk in here as I am playing around experimenting.

Thanks for looking.

ESP8266_NTP_clock_test_21.ino (18.1 KB)

After I posed that I wondered if any of the built in examples had the same problem. I opened NTP-TZ DST clicked compile and got the same error. Here is the code from that example, exactly as is, no editing by me:

/*
  NTP-TZ-DST
  NetWork Time Protocol - Time Zone - Daylight Saving Time

  This example shows how to read and set time,
  and how to use NTP (set NTP0_OR_LOCAL1 to 0 below)
  or an external RTC (set NTP0_OR_LOCAL1 to 1 below)

  TZ and DST below have to be manually set
  according to your local settings.

  This example code is in the public domain.
*/

#include <ESP8266WiFi.h>
#include <time.h>                       // time() ctime()
#include <sys/time.h>                   // struct timeval
#include <coredecls.h>                  // settimeofday_cb()

////////////////////////////////////////////////////////

#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK  "your-password"
#endif

#define SSID            STASSID
#define SSIDPWD         STAPSK
#define TZ              1       // (utc+) TZ in hours
#define DST_MN          60      // use 60mn for summer time in some countries

#define NTP0_OR_LOCAL1  1       // 0:use NTP  1:fake external RTC
#define RTC_TEST     1510592825 // 1510592825 = Monday 13 November 2017 17:07:05 UTC

////////////////////////////////////////////////////////

#define TZ_MN           ((TZ)*60)
#define TZ_SEC          ((TZ)*3600)
#define DST_SEC         ((DST_MN)*60)

timeval cbtime;            // time set in callback
bool cbtime_set = false;

void time_is_set(void) {
  gettimeofday(&cbtime, NULL);
  cbtime_set = true;
  Serial.println("------------------ settimeofday() was called ------------------");
}

void setup() {
  Serial.begin(115200);
  settimeofday_cb(time_is_set);

#if NTP0_OR_LOCAL1
  // local

  ESP.eraseConfig();
  time_t rtc = RTC_TEST;
  timeval tv = { rtc, 0 };
  timezone tz = { TZ_MN + DST_MN, 0 };
  settimeofday(&tv, &tz);

#else // ntp

  configTime(TZ_SEC, DST_SEC, "pool.ntp.org");
  WiFi.mode(WIFI_STA);
  WiFi.begin(SSID, SSIDPWD);
  // don't wait, observe time changing when ntp timestamp is received

#endif // ntp
}

// for testing purpose:
extern "C" int clock_gettime(clockid_t unused, struct timespec *tp);

#define PTM(w) \
  Serial.print(":" #w "="); \
  Serial.print(tm->tm_##w);

void printTm(const char* what, const tm* tm) {
  Serial.print(what);
  PTM(isdst); PTM(yday); PTM(wday);
  PTM(year);  PTM(mon);  PTM(mday);
  PTM(hour);  PTM(min);  PTM(sec);
}

timeval tv;
timespec tp;
time_t now;
uint32_t now_ms, now_us;

void loop() {

  gettimeofday(&tv, nullptr);
  clock_gettime(0, &tp);
  now = time(nullptr);
  now_ms = millis();
  now_us = micros();

  // localtime / gmtime every second change
  static time_t lastv = 0;
  if (lastv != tv.tv_sec) {
    lastv = tv.tv_sec;
    Serial.println();
    printTm("localtime", localtime(&now));
    Serial.println();
    printTm("gmtime   ", gmtime(&now));
    Serial.println();
    Serial.println();
  }

  // time from boot
  Serial.print("clock:");
  Serial.print((uint32_t)tp.tv_sec);
  Serial.print("/");
  Serial.print((uint32_t)tp.tv_nsec);
  Serial.print("ns");

  // time from boot
  Serial.print(" millis:");
  Serial.print(now_ms);
  Serial.print(" micros:");
  Serial.print(now_us);

  // EPOCH+tz+dst
  Serial.print(" gtod:");
  Serial.print((uint32_t)tv.tv_sec);
  Serial.print("/");
  Serial.print((uint32_t)tv.tv_usec);
  Serial.print("us");

  // EPOCH+tz+dst
  Serial.print(" time:");
  Serial.print((uint32_t)now);

  // human readable
  Serial.print(" ctime:(UTC+");
  Serial.print((uint32_t)(TZ * 60 + DST_MN));
  Serial.print("mn)");
  Serial.print(ctime(&now));

  // simple drifting loop
  delay(100);
}

Don't know how you managed that, i'm running older IDE and package 2.4.0 latest package is 2.5.3 i think, but i have had some issues after updating to newer packages and rolling back fixed it. I would try to remove the board URL's and add them again and go through the board manager again.

Don't know how you managed that, I'm running older IDE and package 2.4.0 latest package is 2.5.3 i think

Now I am confused. One of the things I did when I got the problem was to install the latest version, I how have 1.8.9. Where are you getting 2.something from?

I have:
Tried to compile for various other ESP8226 boards, they all give this (or similar) error message:

Arduino: 1.8.9 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, ck, 26 MHz, 40MHz, QIO, 512K (no SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 115200"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Perry Bebbington\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:CpuFrequency=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,FlashSize=512K0,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,UploadSpeed=115200 -vid-pid=0X2341_0X8054 -ide-version=10809 -build-path C:\Users\PERRYB~1\AppData\Local\Temp\arduino_build_796756 -warnings=all -build-cache C:\Users\PERRYB~1\AppData\Local\Temp\arduino_cache_995967 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.esptool.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.12 -prefs=runtime.tools.esptool-0.4.12.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.12 -prefs=runtime.tools.mkspiffs.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.2.0 -prefs=runtime.tools.mkspiffs-0.2.0.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\0.2.0 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -prefs=runtime.tools.xtensa-lx106-elf-gcc-1.20.0-26-gb404fb9-2.path=C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2 -verbose C:\Users\Perry Bebbington\Documents\Arduino\Test\ESP8266_NTP_clock_test_20\ESP8266_NTP_clock_test_20.ino

Board generic (platform esp8266, package esp8266) is unknown

Error compiling for board Generic ESP8266 Module.

I have removed the URLs from preferences, saved, closed the IDE, re-opened, checked the ESP boards have been removed, put them back, reinstalled the board manager. Tried different versions of the board manager. I certainly have not tried every board and every version, but every combination I have tried gives the same result, the above error message.

I can compile for other boards, such as MKR WiFi 1010.

Is there a way to report these problems to whoever it is that creates the files for these boards?

I did some more digging. The solution can be found at
ESP8266 unknown board problem.

Resolved.

PerryBebbington:
Where are you getting 2.something from?

Esp-core package

Deva_Rishi:
Esp-core package

Ah! Of course you are :slight_smile: I think the latest is 2.5.1, which is what I have now.

Thanks for this solution that has worked for me as well