Recently I’ve been building and flashing some projects to the ESP8266 directly using the Espressif SDK for development (not Arduino).
After changing the flash mode, I was still in a reboot loop, but was seeing “rf_cal[0] !=0x05,is 0xFF” just before reboot. This is a known issue that is resolved by reflashing the “init data” (esp_init_data_default.bin) as described here: https://nodemcu.readthedocs.io/en/dev/flash/ (scroll to “SDK Init Data”).
The first thing to try is erase the flash before flashing your code:
esptool.py --port <serial-port-of-ESP8266> erase_flash
If that doesn’t work, flashing the “init” data will likely fix the problem:
esptool.py --port <serial-port-of-ESP8266> write_flash -fm <flash-mode> <flash_addr> esp_init_data_default.bin
Where <flash_mode> would be something like “dout”, “dio” or “qio” (use “dout” for ESP8285, “dio” or “qio” for ESP-12)
and <flash_addr> is determined based on flash size and this table:
0x7c000
for 512 kB, modules like most ESP-01, -03, -07 etc.0xfc000
for 1 MB, modules like ESP8285, PSF-A85, some ESP-01, -03 etc.0x1fc000
for 2 MB0x3fc000
for 4 MB, modules like ESP-12E, NodeMCU devkit 1.0, WeMos D1 mini0x7fc000
for 8 MB0xffc000
for 16 MB, modules like WeMos D1 mini pro