Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion soc/nordic/common/uicr/gen_uicr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
from elftools.elf.elffile import ELFFile
from intelhex import IntelHex

# The UICR format version produced by this script
UICR_FORMAT_VERSION_MAJOR = 2
UICR_FORMAT_VERSION_MINOR = 0

# Name of the ELF section containing PERIPHCONF entries.
# Must match the name used in the linker script.
PERIPHCONF_SECTION = "uicr_periphconf_entry"
Expand Down Expand Up @@ -45,6 +49,14 @@ class PeriphconfEntry(c.LittleEndianStructure):
PERIPHCONF_ENTRY_SIZE = c.sizeof(PeriphconfEntry)


class Version(c.LittleEndianStructure):
_pack_ = 1
_fields_ = [
("MINOR", c.c_uint16),
("MAJOR", c.c_uint16),
]


class Approtect(c.LittleEndianStructure):
_pack_ = 1
_fields_ = [
Expand Down Expand Up @@ -104,7 +116,7 @@ class Mpcconf(c.LittleEndianStructure):
class Uicr(c.LittleEndianStructure):
_pack_ = 1
_fields_ = [
("VERSION", c.c_uint32),
("VERSION", Version),
("RESERVED", c.c_uint32),
("LOCK", c.c_uint32),
("RESERVED1", c.c_uint32),
Expand Down Expand Up @@ -171,6 +183,9 @@ def main() -> None:
init_values = DISABLED_VALUE.to_bytes(4, "little") * (c.sizeof(Uicr) // 4)
uicr = Uicr.from_buffer_copy(init_values)

uicr.VERSION.MAJOR = UICR_FORMAT_VERSION_MAJOR
uicr.VERSION.MINOR = UICR_FORMAT_VERSION_MINOR

kconfig_str = args.in_config.read()
kconfig = parse_kconfig(kconfig_str)

Expand Down