Commit ae191f66 authored by Jonathan Nilsen's avatar Jonathan Nilsen Committed by Benjamin Cabé
Browse files

soc: nordic: uicr: Populate UICR.VERSION field in gen_uicr.py



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: default avatarJonathan Nilsen <jonathan.nilsen@nordicsemi.no>
parent 5f9d20cf
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@ from itertools import groupby
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"
@@ -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_ = [
@@ -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),
@@ -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)