Skip to content

Commit 23e5ec1

Browse files
KonstantinKondrashovradimkarnis
authored andcommitted
feat(espefuse): Set postpone flag by default
1 parent 3077627 commit 23e5ec1

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

espefuse/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@
9393
"Use with caution!",
9494
)
9595
@click.option(
96-
"--postpone",
97-
is_flag=True,
98-
help="Postpone burning some eFuses from BLOCK0 at the end.",
96+
"--postpone/--no-postpone",
97+
default=True,
98+
help="Postpone burning some eFuses from BLOCK0 at the end "
99+
"(enabled by default, can be disabled with --no-postpone).",
99100
)
100101
@click.option(
101102
"--extend-efuse-table",

test/test_espefuse.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,28 +2230,36 @@ def test_burn_ecdsa_key(self):
22302230

22312231

22322232
class TestPostponedEfuses(EfuseTestCase):
2233-
def test_postpone_efuses(self):
2233+
@pytest.mark.parametrize(
2234+
"postpone",
2235+
["--postpone", "--no-postpone", ""],
2236+
ids=["postpone", "no-postopone", "default"],
2237+
)
2238+
def test_postpone_efuses(self, postpone):
22342239
if arg_chip == "esp32":
2235-
cmd = f"--postpone \
2236-
burn-efuse UART_DOWNLOAD_DIS 1 \
2240+
cmd = f"{postpone} \
2241+
burn-efuse UART_DOWNLOAD_DIS 1 DISABLE_BT 1\
22372242
burn-key BLOCK1 {IMAGES_DIR}/256bit \
22382243
burn-efuse ABS_DONE_1 1 FLASH_CRYPT_CNT 1"
22392244
num = 1
22402245
else:
22412246
sb_digest_name = (
22422247
"SECURE_BOOT_DIGEST" if arg_chip == "esp32c2" else "SECURE_BOOT_DIGEST0"
22432248
)
2244-
cmd = f"--postpone \
2249+
cmd = f"{postpone} \
22452250
burn-efuse ENABLE_SECURITY_DOWNLOAD 1 DIS_DOWNLOAD_MODE 1 \
22462251
SECURE_VERSION 1 \
22472252
burn-key BLOCK_KEY0 {IMAGES_DIR}/256bit {sb_digest_name} \
22482253
burn-efuse SPI_BOOT_CRYPT_CNT 1 SECURE_BOOT_EN 1"
22492254
num = 3 if arg_chip == "esp32c2" else 4
22502255
output = self.espefuse_py(cmd)
22512256
assert f"BURN BLOCK{num} - OK" in output
2252-
assert "BURN BLOCK0 - OK" in output
2253-
assert "Burn postponed eFuses from BLOCK0" in output
2254-
assert "BURN BLOCK0 - OK" in output
2257+
if postpone == "--postpone" or postpone == "":
2258+
assert "Burn postponed eFuses from BLOCK0" in output
2259+
assert 2 == output.count("BURN BLOCK0 - OK")
2260+
if postpone == "--no-postpone":
2261+
assert 1 == output.count("BURN BLOCK0 - OK")
2262+
assert "Burn postponed eFuses from BLOCK0" not in output
22552263
assert "Successful" in output
22562264

22572265

0 commit comments

Comments
 (0)