summaryrefslogtreecommitdiff
path: root/tools/binman/etype/nxp_header_ddrfw.py
blob: 655699e6ffa0183bc0cf2f51728eb8f25b480dce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright 2025 NXP

from binman.etype.section import Entry_section

class Entry_nxp_header_ddrfw(Entry_section):
    """Add a header to DDR PHY firmware images

    This entry is used for i.MX95 to combine DDR PHY firmware images and their
    byte counts together.

    See imx95_evk.rst for how to get DDR PHY Firmware Images.
    """

    def __init__(self, section, etype, node):
        super().__init__(section, etype, node)

    def BuildSectionData(self, required):
        section_data = bytearray()
        header_data = bytearray()

        for entry in self._entries.values():
            entry_data = entry.GetData(required)

            section_data += entry_data
            header_data += entry.contents_size.to_bytes(4, 'little')

        return header_data + section_data