Skip to content

Commit da4346b

Browse files
committed
fix: Use correct error codes for ROM errors
Error codes sent from the ROM bootloader were incorrectly mapped in the code and some were missing in the documentation.
1 parent f05fb62 commit da4346b

File tree

2 files changed

+54
-22
lines changed

2 files changed

+54
-22
lines changed

docs/en/advanced-topics/serial-protocol.rst

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,49 @@ The ROM loader sends the following error values
121121
+----------+---------------------------------------------------------------------------+
122122
| Value | Meaning |
123123
+==========+===========================================================================+
124-
| ``0x05`` | "Received message is invalid" (parameters or length field is invalid) |
124+
| ``0x00`` | "Undefined errors" |
125125
+----------+---------------------------------------------------------------------------+
126-
| ``0x06`` | "Failed to act on received message" |
126+
| ``0x01`` | "The input parameter is invalid" |
127127
+----------+---------------------------------------------------------------------------+
128-
| ``0x07`` | "Invalid CRC in message" |
128+
| ``0x02`` | "Failed to malloc memory from system" |
129+
+----------+---------------------------------------------------------------------------+
130+
| ``0x03`` | "Failed to send out message" |
131+
+----------+---------------------------------------------------------------------------+
132+
| ``0x04`` | "Failed to receive message" |
133+
+----------+---------------------------------------------------------------------------+
134+
| ``0x05`` | "The format of the received message is invalid" |
135+
+----------+---------------------------------------------------------------------------+
136+
| ``0x06`` | "Message is ok, but the running result is wrong" |
137+
+----------+---------------------------------------------------------------------------+
138+
| ``0x07`` | "Checksum error" |
129139
+----------+---------------------------------------------------------------------------+
130140
| ``0x08`` | "Flash write error" - after writing a block of data to flash, |
131141
| | the ROM loader reads the value back and the 8-bit CRC is compared |
132142
| | to the data read from flash. If they don't match, this error is returned. |
133143
+----------+---------------------------------------------------------------------------+
134144
| ``0x09`` | "Flash read error" - SPI read failed |
135145
+----------+---------------------------------------------------------------------------+
136-
| ``0x0a`` | "Flash read length error" - SPI read request length is too long |
146+
| ``0x0a`` | "Flash read length error" - SPI read request length is wrong |
147+
+----------+---------------------------------------------------------------------------+
148+
| ``0x0b`` | "Deflate failed error" (compressed uploads only) |
149+
+----------+---------------------------------------------------------------------------+
150+
| ``0x0c`` | "Deflate Adler32 error" |
151+
+----------+---------------------------------------------------------------------------+
152+
| ``0x0d`` | "Deflate parameter error" |
153+
+----------+---------------------------------------------------------------------------+
154+
| ``0x0e`` | "Invalid RAM binary size" |
155+
+----------+---------------------------------------------------------------------------+
156+
| ``0x0f`` | "Invalid RAM binary address" |
157+
+----------+---------------------------------------------------------------------------+
158+
| ``0x64`` | "Invalid parameter" |
159+
+----------+---------------------------------------------------------------------------+
160+
| ``0x65`` | "Invalid format" |
161+
+----------+---------------------------------------------------------------------------+
162+
| ``0x66`` | "Description too long" |
163+
+----------+---------------------------------------------------------------------------+
164+
| ``0x67`` | "Bad encoding description" |
137165
+----------+---------------------------------------------------------------------------+
138-
| ``0x0b`` | "Deflate error" (compressed uploads only) |
166+
| ``0x69`` | "Insufficient storage" |
139167
+----------+---------------------------------------------------------------------------+
140168

141169
Stub Loader Status & Error

esptool/util.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,23 +174,27 @@ def WithResult(message, result):
174174

175175
err_defs = {
176176
# ROM error codes
177-
0x101: "Out of memory",
178-
0x102: "Invalid argument",
179-
0x103: "Invalid state",
180-
0x104: "Invalid size",
181-
0x105: "Requested resource not found",
182-
0x106: "Operation or feature not supported",
183-
0x107: "Operation timed out",
184-
0x108: "Received response was invalid",
185-
0x109: "CRC or checksum was invalid",
186-
0x10A: "Version was invalid",
187-
0x10B: "MAC address was invalid",
188-
0x6001: "Flash operation failed",
189-
0x6002: "Flash operation timed out",
190-
0x6003: "Flash not initialised properly",
191-
0x6004: "Operation not supported by the host SPI bus",
192-
0x6005: "Operation not supported by the flash chip",
193-
0x6006: "Can't write, protection enabled",
177+
0x100: "Undefined errors",
178+
0x101: "The input parameter is invalid",
179+
0x102: "Failed to malloc memory from system",
180+
0x103: "Failed to send out message",
181+
0x104: "Failed to receive message",
182+
0x105: "The format of the received message is invalid",
183+
0x106: "Message is ok, but the running result is wrong",
184+
0x107: "Checksum error",
185+
0x108: "Flash write error",
186+
0x109: "Flash read error",
187+
0x10A: "Flash read length error",
188+
0x10B: "Deflate failed error",
189+
0x10C: "Deflate Adler32 error",
190+
0x10D: "Deflate parameter error",
191+
0x10E: "Invalid RAM binary size",
192+
0x10F: "Invalid RAM binary address",
193+
0x164: "Invalid parameter",
194+
0x165: "Invalid format",
195+
0x166: "Description too long",
196+
0x167: "Bad encoding description",
197+
0x169: "Insufficient storage",
194198
# Flasher stub error codes
195199
0xC000: "Bad data length",
196200
0xC100: "Bad data checksum",

0 commit comments

Comments
 (0)