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.
This commit is contained in:
Jaroslav Burian
2025-08-26 10:16:29 +02:00
parent f05fb6207f
commit da4346b86e
2 changed files with 54 additions and 22 deletions

View File

@@ -121,11 +121,21 @@ The ROM loader sends the following error values
+----------+---------------------------------------------------------------------------+
| Value | Meaning |
+==========+===========================================================================+
| ``0x05`` | "Received message is invalid" (parameters or length field is invalid) |
| ``0x00`` | "Undefined errors" |
+----------+---------------------------------------------------------------------------+
| ``0x06`` | "Failed to act on received message" |
| ``0x01`` | "The input parameter is invalid" |
+----------+---------------------------------------------------------------------------+
| ``0x07`` | "Invalid CRC in message" |
| ``0x02`` | "Failed to malloc memory from system" |
+----------+---------------------------------------------------------------------------+
| ``0x03`` | "Failed to send out message" |
+----------+---------------------------------------------------------------------------+
| ``0x04`` | "Failed to receive message" |
+----------+---------------------------------------------------------------------------+
| ``0x05`` | "The format of the received message is invalid" |
+----------+---------------------------------------------------------------------------+
| ``0x06`` | "Message is ok, but the running result is wrong" |
+----------+---------------------------------------------------------------------------+
| ``0x07`` | "Checksum error" |
+----------+---------------------------------------------------------------------------+
| ``0x08`` | "Flash write error" - after writing a block of data to flash, |
| | the ROM loader reads the value back and the 8-bit CRC is compared |
@@ -133,9 +143,27 @@ The ROM loader sends the following error values
+----------+---------------------------------------------------------------------------+
| ``0x09`` | "Flash read error" - SPI read failed |
+----------+---------------------------------------------------------------------------+
| ``0x0a`` | "Flash read length error" - SPI read request length is too long |
| ``0x0a`` | "Flash read length error" - SPI read request length is wrong |
+----------+---------------------------------------------------------------------------+
| ``0x0b`` | "Deflate error" (compressed uploads only) |
| ``0x0b`` | "Deflate failed error" (compressed uploads only) |
+----------+---------------------------------------------------------------------------+
| ``0x0c`` | "Deflate Adler32 error" |
+----------+---------------------------------------------------------------------------+
| ``0x0d`` | "Deflate parameter error" |
+----------+---------------------------------------------------------------------------+
| ``0x0e`` | "Invalid RAM binary size" |
+----------+---------------------------------------------------------------------------+
| ``0x0f`` | "Invalid RAM binary address" |
+----------+---------------------------------------------------------------------------+
| ``0x64`` | "Invalid parameter" |
+----------+---------------------------------------------------------------------------+
| ``0x65`` | "Invalid format" |
+----------+---------------------------------------------------------------------------+
| ``0x66`` | "Description too long" |
+----------+---------------------------------------------------------------------------+
| ``0x67`` | "Bad encoding description" |
+----------+---------------------------------------------------------------------------+
| ``0x69`` | "Insufficient storage" |
+----------+---------------------------------------------------------------------------+
Stub Loader Status & Error

View File

@@ -174,23 +174,27 @@ class FatalError(RuntimeError):
err_defs = {
# ROM error codes
0x101: "Out of memory",
0x102: "Invalid argument",
0x103: "Invalid state",
0x104: "Invalid size",
0x105: "Requested resource not found",
0x106: "Operation or feature not supported",
0x107: "Operation timed out",
0x108: "Received response was invalid",
0x109: "CRC or checksum was invalid",
0x10A: "Version was invalid",
0x10B: "MAC address was invalid",
0x6001: "Flash operation failed",
0x6002: "Flash operation timed out",
0x6003: "Flash not initialised properly",
0x6004: "Operation not supported by the host SPI bus",
0x6005: "Operation not supported by the flash chip",
0x6006: "Can't write, protection enabled",
0x100: "Undefined errors",
0x101: "The input parameter is invalid",
0x102: "Failed to malloc memory from system",
0x103: "Failed to send out message",
0x104: "Failed to receive message",
0x105: "The format of the received message is invalid",
0x106: "Message is ok, but the running result is wrong",
0x107: "Checksum error",
0x108: "Flash write error",
0x109: "Flash read error",
0x10A: "Flash read length error",
0x10B: "Deflate failed error",
0x10C: "Deflate Adler32 error",
0x10D: "Deflate parameter error",
0x10E: "Invalid RAM binary size",
0x10F: "Invalid RAM binary address",
0x164: "Invalid parameter",
0x165: "Invalid format",
0x166: "Description too long",
0x167: "Bad encoding description",
0x169: "Insufficient storage",
# Flasher stub error codes
0xC000: "Bad data length",
0xC100: "Bad data checksum",