mirror of
https://github.com/espressif/esptool.git
synced 2025-10-19 11:43:48 +08:00
feat(espefuse): Allow the espefuse.py to work when coding scheme == 3
Signed-off-by: Francisco Blas (klondike) Izquierdo Riera <klondike@klondike.es> Closes https://github.com/espressif/esptool/pull/950
This commit is contained in:

committed by
Konstantin Kondrashov

parent
4b87de17d1
commit
1e79f25835
@@ -76,7 +76,7 @@ The coding scheme helps the eFuse controller to detect an error of the eFuse blo
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
* ``None`` no need any special encoding data. BLOCK0.
|
||||
* ``None`` no need any special encoding data. BLOCK0 is always None.
|
||||
* ``3/4``, requires encoding data. The BLOCK length is reduced from 256 bits to 192 bits.
|
||||
* ``Repeat`` not supported by this tool and IDF. The BLOCK length is reduced from 256 bits to 128 bits.
|
||||
|
||||
|
@@ -75,10 +75,14 @@ class EmulateEfuseController(EmulateEfuseControllerBase):
|
||||
self.save_to_file()
|
||||
|
||||
def read_raw_coding_scheme(self):
|
||||
return (
|
||||
coding_scheme = (
|
||||
self.read_efuse(self.REGS.EFUSE_CODING_SCHEME_WORD)
|
||||
& self.REGS.EFUSE_CODING_SCHEME_MASK
|
||||
)
|
||||
if coding_scheme == self.REGS.CODING_SCHEME_NONE_RECOVERY:
|
||||
return self.REGS.CODING_SCHEME_NONE
|
||||
else:
|
||||
return coding_scheme
|
||||
|
||||
def write_raw_coding_scheme(self, value):
|
||||
self.write_efuse(
|
||||
|
@@ -157,10 +157,14 @@ class EspEfuses(base_fields.EspEfusesBase):
|
||||
raise KeyError
|
||||
|
||||
def read_coding_scheme(self):
|
||||
self.coding_scheme = (
|
||||
coding_scheme = (
|
||||
self.read_efuse(self.REGS.EFUSE_CODING_SCHEME_WORD)
|
||||
& self.REGS.EFUSE_CODING_SCHEME_MASK
|
||||
)
|
||||
if coding_scheme == self.REGS.CODING_SCHEME_NONE_RECOVERY:
|
||||
self.coding_scheme = self.REGS.CODING_SCHEME_NONE
|
||||
else:
|
||||
self.coding_scheme = coding_scheme
|
||||
|
||||
def print_status_regs(self):
|
||||
print("")
|
||||
|
@@ -272,9 +272,12 @@ class ESP32ROM(ESPLoader):
|
||||
coding_scheme = word6 & 0x3
|
||||
features += [
|
||||
"Coding Scheme %s"
|
||||
% {0: "None", 1: "3/4", 2: "Repeat (UNSUPPORTED)", 3: "Invalid"}[
|
||||
coding_scheme
|
||||
]
|
||||
% {
|
||||
0: "None",
|
||||
1: "3/4",
|
||||
2: "Repeat (UNSUPPORTED)",
|
||||
3: "None (may contain encoding data)",
|
||||
}[coding_scheme]
|
||||
]
|
||||
|
||||
return features
|
||||
|
@@ -113,6 +113,9 @@ class EfuseTestCase:
|
||||
def _set_34_coding_scheme(self):
|
||||
self.espefuse_py("burn_efuse CODING_SCHEME 1")
|
||||
|
||||
def _set_none_recovery_coding_scheme(self):
|
||||
self.espefuse_py("burn_efuse CODING_SCHEME 3")
|
||||
|
||||
def check_data_block_in_log(
|
||||
self, log, file_path, repeat=1, reverse_order=False, offset=0
|
||||
):
|
||||
@@ -1683,6 +1686,16 @@ class TestBurnBitCommands(EfuseTestCase):
|
||||
ret_code=2,
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(arg_chip != "esp32", reason="ESP32-only")
|
||||
def test_burn_bit_with_none_recovery_coding_scheme(self):
|
||||
self._set_none_recovery_coding_scheme()
|
||||
self.espefuse_py("burn_bit BLOCK3 0 1 2 4 8 16 32 64 96 128 160 192 224 255")
|
||||
self.espefuse_py(
|
||||
"summary",
|
||||
check_msg="17 01 01 00 01 00 00 00 01 00 00 00 01 00 00 "
|
||||
"00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 80",
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
arg_chip != "esp32", reason="Tests are only for esp32. (TODO: add for all chips)"
|
||||
|
Reference in New Issue
Block a user