Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By jacksonliam
#38298 It appears that using a system_restart() from the SDK it will just restart into whatever mode was last booted into.

Does anyone know any way of booting into a different mode programatically, no matter what pull ups/down are connected to GPIO 15/4/0?

Can I jump to an address (or use the system_restart_enhance) which contains the bootloader for the different boot modes? Does anyone know these addresses?
User avatar
By martinayotte
#38303 According to wiki/doku.php?id=esp8266_memory_map, the ROM is located 40000000h.
ResetHandler seems to be located at 0x400000a4
https://github.com/pvvx/esp8266web/blob ... ld#L52-L53

I don't think you can skip GPIO15/GPIO2/GPIO0 boot process, and even if you found a workaround, you can be in trouble if your module restart for some other reasons such as power failure. So, pullups/pulldown on those pins still need to be properly set.
User avatar
By jacksonliam
#38310
martinayotte wrote:ResetHandler seems to be located at 0x400000a4
https://github.com/pvvx/esp8266web/blob ... ld#L52-L53

I don't think you can skip GPIO15/GPIO2/GPIO0 boot process, and even if you found a workaround, you can be in trouble if your module restart for some other reasons such as power failure. So, pullups/pulldown on those pins still need to be properly set.

Thanks, thats a useful link.

After reboot im not bothered which mode it comes up in, as long as I can switch between them in the ESP code I can handle it.

There's this:
Code: Select allvoid system_restart_core(void)
{
   Cache_Read_Disable();
   DPORT_OFF24 &= 0x67; // 0x3FF00024 &= 0x67;
   Call _ResetVector(); // ROM:0x40000080
}

Which appears to be doing something to the flash cache (marking it to be re-read from flash?)

There's a dissassembly of the boot rom here (http://cholla.mmto.org/esp8266/bootrom/notes.txt), but I can't see anywhere in the reset vector/handler thats reading the GPIO register addresses, so I'm either reading it wrong (highly possible) or the boot mode selection is happening before the boot rom.
User avatar
By martinayotte
#38312 Your link is interesting too ! ;-)
Unfortunately, especially that I'm not fluent with ESP assembly, I don't see code for GPIO15/GPIO2/GPIO0.
Maybe it is done in hardware, simply by fetching vectors elsewhere ...
So, maybe you won't have choice to deal with the pullups anyway, also for the reason I've mentioned, such as power recycling.