16M D1 Mini Pro + SDK 2.2.1
Posted: Sat Aug 22, 2020 1:00 pm
Trying to flash the latest MicroPython to a 16M Wemos D1 Mini Pro.
Hit a problem where it would get stuck in a boot loop.
Initially, I thought it was a problem with make deploy not including the write esp_init_data_default.bin to 0xffc000 in the esptool.py command, like I had done manually before.
When I added the latest esp_init_data_default_v08.bin to the write_flash command and it worked.
Tried again without the write to 0xffc000 and it gets stuck in a boot loop.
Further investigation revealed back in 2016, the init data was actually added in (esp_init_data.c).
The commit from 2016:
https://github.com/micropython/micropyt ... ad60e7e832
In the SDK 2.2.1 zip there are 2 init datas in /bin:
* esp_init_data_default_v05.bin
* esp_init_data_default_v08.bin
When comparing SDK 2.2.1 with SDK 2.2.0 and SDK 2.1.0, the v05.bin matches the original esp_init_data_default.bin and what is in esp8266/esp_init_data.c. The v08.bin has a few differences.
esp_init_data.c and esp_init_data_default_v05.bin
0500 0402 0505 0502 0500 0405 0504 0505
04fe fdff f0f0 f0e0 e0e0 e10a ffff f800
f8f8 524e 4a44 4038 0000 0101 0203 0405
0100 0000 0000 0200 0000 0000 0000 0000
e10a 0000 0000 0000 0000 0193 4300 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0100 0000 0000 0000 0000 0000 0000
esp_init_data_default_v08.bin
0508 0402 0505 0502 0500 0405 0504 0505
04fe fdff f0f0 f0e0 e0e0 e10a ffff f800
f8f8 4e4a 4640 3c38 0000 0101 0203 0405
0100 0000 0000 0200 0000 0000 0000 0000
e10a 0000 0000 0000 0000 0193 4300 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0100 0000 0000 0000 0000 0000 0000
[/code]
Since the esp8266/esp_init_data.c bytes match esp_init_data_default_v05.bin, and flashing esp_init_data_default_v08.bin with esptool.py worked, I tried updating esp8266/esp_init_data.c with the 8 different bytes from the v08.bin, highlighted above.
Didn't work. Still stuck in boot loop.
Changing the bytes in static const uint8_t default_init_data[] to v08.bin had no effect. Rollback.
Now, if I write_flash that v08.bin, it reboots and starts working.
Hit a problem where it would get stuck in a boot loop.
Initially, I thought it was a problem with make deploy not including the write esp_init_data_default.bin to 0xffc000 in the esptool.py command, like I had done manually before.
When I added the latest esp_init_data_default_v08.bin to the write_flash command and it worked.
Code: Select all
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 460800 erase_flash
make
cp esp-open-sdk/ESP8266_NONOS_SDK-2.2.1/bin/esp_init_data_default_v08.bin build-GENERIC/
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 460800 write_flash -fm dio -fs 16MB 0 build-GENERIC/firmware-combined.bin 0xffc000 build-GENERIC/esp_init_data_default_v08.bin
Further investigation revealed back in 2016, the init data was actually added in (esp_init_data.c).
The commit from 2016:
https://github.com/micropython/micropyt ... ad60e7e832
Looks like that is what I am seeing now my fresh esp-open-sdk build using SDK 2.2.1, as the init data has changed.SDK 2.0.0 goes into boot loop if a firmware is programmed over erased flash
In the SDK 2.2.1 zip there are 2 init datas in /bin:
* esp_init_data_default_v05.bin
* esp_init_data_default_v08.bin
When comparing SDK 2.2.1 with SDK 2.2.0 and SDK 2.1.0, the v05.bin matches the original esp_init_data_default.bin and what is in esp8266/esp_init_data.c. The v08.bin has a few differences.
esp_init_data.c and esp_init_data_default_v05.bin
0500 0402 0505 0502 0500 0405 0504 0505
04fe fdff f0f0 f0e0 e0e0 e10a ffff f800
f8f8 524e 4a44 4038 0000 0101 0203 0405
0100 0000 0000 0200 0000 0000 0000 0000
e10a 0000 0000 0000 0000 0193 4300 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0100 0000 0000 0000 0000 0000 0000
esp_init_data_default_v08.bin
0508 0402 0505 0502 0500 0405 0504 0505
04fe fdff f0f0 f0e0 e0e0 e10a ffff f800
f8f8 4e4a 4640 3c38 0000 0101 0203 0405
0100 0000 0000 0200 0000 0000 0000 0000
e10a 0000 0000 0000 0000 0193 4300 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0100 0000 0000 0000 0000 0000 0000
[/code]
Since the esp8266/esp_init_data.c bytes match esp_init_data_default_v05.bin, and flashing esp_init_data_default_v08.bin with esptool.py worked, I tried updating esp8266/esp_init_data.c with the 8 different bytes from the v08.bin, highlighted above.
Code: Select all
(edited esp8266/esp_init_data.c's default_init_data with v08 bytes)
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 460800 erase_flash
make clean
make PORT=/dev/tty.SLAB_USBtoUART deploy
Changing the bytes in static const uint8_t default_init_data[] to v08.bin had no effect. Rollback.
Now, if I write_flash that v08.bin, it reboots and starts working.
Code: Select all
cp esp-open-sdk/ESP8266_NONOS_SDK-2.2.1/bin/esp_init_data_default_v08.bin build-GENERIC/
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 460800 write_flash -fm dio -fs 16MB 0xffc000 build-GENERIC/esp_init_data_default_v08.bin
Code: Select all
MPY: soft reboot
MicroPython v1.12-665-g60f5b941e-dirty on 2020-08-22; ESP module with ESP8266
Type "help()" for more information.