You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/api-guides/partition-tables.rst
+26-41
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,25 @@ Partition Tables
4
4
Overview
5
5
--------
6
6
7
-
A single ESP32's flash can contain multiple apps, as well as many different kinds of data (calibration data, filesystems, parameter storage, etc). For this reason a partition table is flashed to offset 0x8000 in the flash.
7
+
A single ESP8266's flash can contain multiple apps, as well as many different kinds of data (calibration data, filesystems, parameter storage, etc). For this reason a partition table is flashed to offset 0x8000 in the flash.
8
8
9
-
Partition table length is 0xC00 bytes (maximum 95 partition table entries). An MD5 checksum is appended after the table data. If the partition table is signed due to `secure boot`, the signature is appended after the partition table.
9
+
Partition table length is 0xC00 bytes (maximum 95 partition table entries). An MD5 checksum is appended after the table data.
10
10
11
11
Each entry in the partition table has a name (label), type (app, data, or something else), subtype and the offset in flash where the partition is loaded.
12
12
13
13
The simplest way to use the partition table is to `make menuconfig` and choose one of the simple predefined partition tables:
14
14
15
15
* "Single factory app, no OTA"
16
-
* "Factory app, two OTA definitions"
16
+
* "Two OTA app"
17
17
18
-
In both cases the factory app is flashed at offset 0x10000. If you `make partition_table` then it will print a summary of the partition table.
18
+
If you `make partition_table` then it will print a summary of the partition table.
19
19
20
20
Built-in Partition Tables
21
21
-------------------------
22
22
23
23
Here is the summary printed for the "Single factory app, no OTA" configuration::
24
24
25
-
# Espressif ESP32 Partition Table
25
+
# Espressif ESP8266 Partition Table
26
26
# Name, Type, SubType, Offset, Size
27
27
nvs, data, nvs, 0x9000, 0x6000
28
28
phy_init, data, phy, 0xf000, 0x1000
@@ -31,20 +31,18 @@ Here is the summary printed for the "Single factory app, no OTA" configuration::
31
31
* At a 0x10000 (64KB) offset in the flash is the app labelled "factory". The bootloader will run this app by default.
32
32
* There are also two data regions defined in the partition table for storing NVS library partition and PHY init data.
33
33
34
-
Here is the summary printed for the "Factory app, two OTA definitions" configuration::
34
+
Here is the summary printed for the "Two OTA definitions" configuration::
35
35
36
-
# Espressif ESP32 Partition Table
37
-
# Name, Type, SubType, Offset, Size
38
-
nvs, data, nvs, 0x9000, 0x4000
39
-
otadata, data, ota, 0xd000, 0x2000
40
-
phy_init, data, phy, 0xf000, 0x1000
41
-
factory, 0, 0, 0x10000, 1M
42
-
ota_0, 0, ota_0, , 1M
43
-
ota_1, 0, ota_1, , 1M
36
+
# Espressif ESP8266 Partition Table
37
+
# Name, Type, SubType, Offset, Size
38
+
nvs, data, nvs, 0x9000, 0x4000
39
+
otadata, data, ota, 0xd000, 0x2000
40
+
phy_init, data, phy, 0xf000, 0x1000
41
+
ota_0, 0, ota_0, 0x10000, 1M
42
+
ota_1, 0, ota_1, 0x110000, 1M
44
43
45
-
* There are now three app partition definitions.
46
-
* The type of all three are set as "app", but the subtype varies between the factory app at 0x10000 and the next two "OTA" apps.
47
-
* There is also a new "ota data" slot, which holds the data for OTA updates. The bootloader consults this data in order to know which app to execute. If "ota data" is empty, it will execute the factory app.
44
+
* There are now two app partition definitions, ota_0 at 0x10000 and ota_1 at 0x110000
45
+
* There is also a new "ota data" slot, which holds the data for OTA updates. The bootloader consults this data in order to know which app to execute. If "ota data" is empty, it will execute the ota_0 app.
48
46
49
47
Creating Custom Tables
50
48
----------------------
@@ -54,12 +52,11 @@ If you choose "Custom partition table CSV" in menuconfig then you can also enter
54
52
The CSV format is the same format as printed in the summaries shown above. However, not all fields are required in the CSV. For example, here is the "input" CSV for the OTA partition table::
55
53
56
54
# Name, Type, SubType, Offset, Size
57
-
nvs, data, nvs, 0x9000, 0x4000
58
-
otadata, data, ota, 0xd000, 0x2000
59
-
phy_init, data, phy, 0xf000, 0x1000
60
-
factory, app, factory, 0x10000, 1M
61
-
ota_0, app, ota_0, , 1M
62
-
ota_1, app, ota_1, , 1M
55
+
nvs, data, nvs, 0x9000, 0x4000
56
+
otadata, data, ota, 0xd000, 0x2000
57
+
phy_init, data, phy, 0xf000, 0x1000
58
+
ota_0, app, ota_0, 0x10000, 1M
59
+
ota_1, app, ota_1, 0x110000, 1M
63
60
64
61
* Whitespace between fields is ignored, and so is any line starting with # (comments).
65
62
* Each non-comment line in the CSV file is a partition definition.
@@ -68,7 +65,7 @@ The CSV format is the same format as printed in the summaries shown above. Howev
68
65
Name field
69
66
~~~~~~~~~~
70
67
71
-
Name field can be any meaningful name. It is not significant to the ESP32. Names longer than 16 characters will be truncated.
68
+
Name field can be any meaningful name. It is not significant to the ESP8266. Names longer than 16 characters will be truncated.
72
69
73
70
Type field
74
71
~~~~~~~~~~
@@ -89,14 +86,11 @@ esp-idf currently only specifies the meaning of the subtype field for "app" and
89
86
App Subtypes
90
87
~~~~~~~~~~~~
91
88
92
-
When type is "app", the subtype field can be specified as factory (0), ota_0 (0x10) ... ota_15 (0x1F) or test (0x20).
89
+
When type is "app", the subtype field can be specified as ota_0 (0x10), ota_1 (0x11) ... ota_15 (0x1F) or test (0x20).
93
90
94
-
- factory (0) is the default app partition. The bootloader will execute the factory app unless there it sees a partition of type data/ota, in which case it reads this partition to determine which OTA image to boot.
91
+
- ota_0 (0x10) is the default app partition. The bootloader will execute the ota_0 app unless there it sees another partition of type data/ota, in which case it reads this partition to determine which OTA image to boot.
95
92
96
-
- OTA never updates the factory partition.
97
-
- If you want to conserve flash usage in an OTA project, you can remove the factory partition and use ota_0 instead.
98
93
- ota_0 (0x10) ... ota_15 (0x1F) are the OTA app slots. Refer to the :doc:`OTA documentation <../api-reference/system/ota>` for more details, which then use the OTA data partition to configure which app slot the bootloader should boot. If using OTA, an application should have at least two OTA application slots (ota_0 & ota_1). Refer to the :doc:`OTA documentation <../api-reference/system/ota>` for more details.
99
-
- test (0x2) is a reserved subtype for factory test procedures. It is not currently supported by the esp-idf bootloader.
100
94
101
95
Data Subtypes
102
96
~~~~~~~~~~~~~
@@ -107,7 +101,7 @@ When type is "data", the subtype field can be specified as ota (0), phy (1), nvs
107
101
- phy (1) is for storing PHY initialisation data. This allows PHY to be configured per-device, instead of in firmware.
108
102
109
103
- In the default configuration, the phy partition is not used and PHY initialisation data is compiled into the app itself. As such, this partition can be removed from the partition table to save space.
110
-
- To load PHY data from this partition, run ``make menuconfig`` and enable :envvar:`CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION` option. You will also need to flash your devices with phy init data as the esp-idf build system does not do this automatically.
104
+
- To load PHY data from this partition, run ``make menuconfig`` and enable :envvar:`ESP_PHY_INIT_DATA_IN_PARTITION` option. You will also need to flash your devices with phy init data as the esp-idf build system does not do this automatically.
111
105
- nvs (2) is for the :doc:`Non-Volatile Storage (NVS) API <../api-reference/storage/nvs_flash>`.
112
106
113
107
- NVS is used to store per-device PHY calibration data (different to initialisation data).
@@ -130,7 +124,7 @@ Sizes and offsets can be specified as decimal numbers, hex numbers with the pref
130
124
Generating Binary Partition Table
131
125
---------------------------------
132
126
133
-
The partition table which is flashed to the ESP32 is in a binary format, not CSV. The tool :component_file:`partition_table/gen_esp32part.py` is used to convert between CSV and binary formats.
127
+
The partition table which is flashed to the ESP8266 is in a binary format, not CSV. The tool :component_file:`partition_table/gen_esp32part.py` is used to convert between CSV and binary formats.
134
128
135
129
If you configure the partition table CSV name in ``make menuconfig`` and then ``make partition_table``, this conversion is done as part of the build process.
136
130
@@ -148,13 +142,6 @@ To display the contents of a binary partition table on stdout (this is how the s
148
142
149
143
``gen_esp32part.py`` takes one optional argument, ``--verify``, which will also verify the partition table during conversion (checking for overlapping partitions, unaligned partitions, etc.)
150
144
151
-
MD5 checksum
152
-
~~~~~~~~~~~~
153
-
154
-
The binary format of the partition table contains an MD5 checksum computed based on the partition table. This checksum is used for checking the integrity of the partition table during the boot.
155
-
156
-
The MD5 checksum generation can be disabled by the ``--disable-md5sum`` option of ``gen_esp32part.py`` or by the :envvar:`CONFIG_PARTITION_TABLE_MD5` option. This is useful for example when one uses a legacy bootloader which cannot process MD5 checksums and the boot fails with the error message ``invalid magic number 0xebeb``.
157
-
158
145
Flashing the partition table
159
146
----------------------------
160
147
@@ -163,6 +150,4 @@ Flashing the partition table
163
150
164
151
A manual flashing command is also printed as part of ``make partition_table``.
165
152
166
-
Note that updating the partition table doesn't erase data that may have been stored according to the old partition table. You can use ``make erase_flash`` (or ``esptool.py erase_flash``) to erase the entire flash contents.
167
-
168
-
.. _secure boot: security/secure-boot.rst
153
+
Note that updating the partition table doesn't erase data that may have been stored according to the old partition table. You can use ``make erase_flash`` (or ``esptool.py erase_flash``) to erase the entire flash contents.
0 commit comments