Skip to content

Commit a22aa53

Browse files
committed
docs/esp8266/general: Add "Boot process" section.
1 parent 12144e8 commit a22aa53

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

docs/esp8266/general.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,38 @@ For your convinience, some of technical specifications are provided below:
5656
* I2S: 1.
5757
* Programming: using BootROM bootloader from UART. Due to external FlashROM
5858
and always-available BootROM bootloader, ESP8266 is not brickable.
59+
60+
61+
Boot process
62+
------------
63+
64+
On boot, MicroPython EPS8266 port executes ``_boot.py`` script from internal
65+
frozen modules. It mounts filesystem in FlashROM, or if it's not available,
66+
performs first-time setup of the module and creates the filesystem. This
67+
part of boot process is considered fixed, and not available for customization
68+
for end users (even if you build from source, please refrain from changes to
69+
it; customization of early boot process is available only to advanced users
70+
and developers, who can diagnose themselves any issues arising from
71+
modifying the standard process).
72+
73+
Once filesystem is mounted, ``boot.py`` is executed from it. The standard
74+
version of this file is created during first-time module set up and by
75+
defaults starts up a WebREPL daemon to handle incoming connections. This
76+
file is customizable by end users (for example, you may want to disable
77+
WebREPL for extra security, or add other services which should be run on
78+
module start-up). But keep in mind that incorrect modifications to boot.py
79+
may still lead to boot loops or lock ups, requiring to reflash a module
80+
from scratch.
81+
82+
As a final step of boot procedure, ``main.py`` is executed from filesystem,
83+
if exists. This file is a hook to start up a user application each time
84+
on boot (instead of going to REPL). For small test applications, you may
85+
name them directly as ``main.py``, and upload to module, but instead it's
86+
recommended to keep your application(s) in separate files, and have just
87+
the following in ``main.py``::
88+
89+
import my_app
90+
my_app.main()
91+
92+
This will allow to keep structure of your application clear, as well as
93+
allow to install multiple applications on a board, and switch among them.

0 commit comments

Comments
 (0)