Skip to content

Commit 7d913ca

Browse files
jonathannilsenrlubos
authored andcommitted
[nrf fromlist] soc: nordic: uicr: Populate UICR.VERSION field in gen_uicr.py
Upstream PR #: 94064 Set the VERSION field to 2.0 in gen_uicr.py to indicate the version of the format the script produces blobs for. This is required for forwards compatibility with newer versions of IronSide SE. Signed-off-by: Jonathan Nilsen <[email protected]>
1 parent 7de4733 commit 7d913ca

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

soc/nordic/common/uicr/gen_uicr.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
from elftools.elf.elffile import ELFFile
1818
from intelhex import IntelHex
1919

20+
# The UICR format version produced by this script
21+
UICR_FORMAT_VERSION_MAJOR = 2
22+
UICR_FORMAT_VERSION_MINOR = 0
23+
2024
# Name of the ELF section containing PERIPHCONF entries.
2125
# Must match the name used in the linker script.
2226
PERIPHCONF_SECTION = "uicr_periphconf_entry"
@@ -45,6 +49,14 @@ class PeriphconfEntry(c.LittleEndianStructure):
4549
PERIPHCONF_ENTRY_SIZE = c.sizeof(PeriphconfEntry)
4650

4751

52+
class Version(c.LittleEndianStructure):
53+
_pack_ = 1
54+
_fields_ = [
55+
("MINOR", c.c_uint16),
56+
("MAJOR", c.c_uint16),
57+
]
58+
59+
4860
class Approtect(c.LittleEndianStructure):
4961
_pack_ = 1
5062
_fields_ = [
@@ -104,7 +116,7 @@ class Mpcconf(c.LittleEndianStructure):
104116
class Uicr(c.LittleEndianStructure):
105117
_pack_ = 1
106118
_fields_ = [
107-
("VERSION", c.c_uint32),
119+
("VERSION", Version),
108120
("RESERVED", c.c_uint32),
109121
("LOCK", c.c_uint32),
110122
("RESERVED1", c.c_uint32),
@@ -171,6 +183,9 @@ def main() -> None:
171183
init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4)
172184
uicr = Uicr.from_buffer_copy(init_values)
173185

186+
uicr.VERSION.MAJOR = UICR_FORMAT_VERSION_MAJOR
187+
uicr.VERSION.MINOR = UICR_FORMAT_VERSION_MINOR
188+
174189
kconfig_str = args.in_config.read()
175190
kconfig = parse_kconfig(kconfig_str)
176191

0 commit comments

Comments
 (0)