Skip to content

Commit 8bbc314

Browse files
michalek-nonvlsianpu
authored andcommitted
scripts: reglock round down
sets maximum allowed region size in case requested size overflows. Signed-off-by: Mateusz Michalek <[email protected]>
1 parent 8c256f4 commit 8bbc314

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/reglock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from intelhex import IntelHex
2222
import argparse
2323
import sys
24+
import warnings
2425

2526
SIZE_MAX_KB = 31
2627

@@ -57,7 +58,8 @@ def main():
5758
sys.exit("error: requested size not aligned to 1k")
5859
size = size // 1024
5960
if size > SIZE_MAX_KB:
60-
sys.exit("error: requested size too big")
61+
warnings.warn("warning: requested size too big; Setting to allowed maximum")
62+
size = SIZE_MAX_KB
6163

6264
payload = bytearray([
6365
READ_ALLOWED | EXECUTE_ALLOWED | SECURE | OWNER_NONE,

0 commit comments

Comments
 (0)