util/rom-ext-manifest-generator.py
def generate_cheader(fields, input_dir, output_dir):
    """ Generates C header file from the `template_file`.

    It produces a list of tuples with a field name and the `MemoryRegion`
    object, whic is used in the `template_path`. The resulting header file is
    placed into `output_path`.
    """

    template_path = input_dir / 'manifest.h.tpl'
    output_path = output_dir / 'manifest.h'

    base_name = Name.from_snake_case("ROM_EXT")

    items = []
    offset = 0
    for field in fields:
        assert field['size'] % 8 == 0
        size_bytes = field['size'] // 8
        if field['type'] == "field":
            region_name = base_name + Name.from_snake_case(field['name'])
            region = MemoryRegion(region_name, offset, size_bytes)
            items.append((field['name'], region))
        offset += size_bytes

    with template_path.open('r') as f:
        template = Template(f.read())

    header = template.render(items=items)

    with output_path.open('w') as f:
        f.write(header)

    print('Template sucessfuly written to {}.'.format(output_path))
 Generates C header file from the `template_file`.

    It produces a list of tuples with a field name and the `MemoryRegion`
    object, whic is used in the `template_path`. The resulting header file is
    placed into `output_path`.
    
Generates C header file from the `template_file`.
It produces a list of tuples with a field name and the `MemoryRegion`
object, whic is used in the `template_path`. The resulting header file is
placed into `output_path`.
Generates C header file from the ` template_file ` . It produces a list of tuples with a field name and the ` MemoryRegion ` object whic is used in the ` template_path ` . The resulting header file is placed into ` output_path ` .
def generate_cheader(fields, input_dir, output_dir):
    template_path = input_dir / 'manifest.h.tpl'
    output_path = output_dir / 'manifest.h'
    base_name = Name.from_snake_case("ROM_EXT")
    items = []
    offset = 0
    for field in fields:
        assert field['size'] % 8 == 0
        size_bytes = field['size'] // 8
        if field['type'] == "field":
            region_name = base_name + Name.from_snake_case(field['name'])
            region = MemoryRegion(region_name, offset, size_bytes)
            items.append((field['name'], region))
        offset += size_bytes
    with template_path.open('r') as f:
        template = Template(f.read())
    header = template.render(items=items)
    with output_path.open('w') as f:
        f.write(header)
    print('Template sucessfuly written to {}.'.format(output_path))
def generate_cheader ( fields , input_dir , output_dir ) : template_path = input_dir / 'manifest.h.tpl' output_path = output_dir / 'manifest.h' base_name = Name . from_snake_case ( "ROM_EXT" ) items = [ ] offset = 0 for field in fields : assert field [ 'size' ] % 8 == 0 size_bytes = field [ 'size' ] // 8 if field [ 'type' ] == "field" : region_name = base_name + Name . from_snake_case ( field [ 'name' ] ) region = MemoryRegion ( region_name , offset , size_bytes ) items . append ( ( field [ 'name' ] , region ) ) offset += size_bytes with template_path . open ( 'r' ) as f : template = Template ( f . read ( ) ) header = template . render ( items = items ) with output_path . open ( 'w' ) as f : f . write ( header ) print ( 'Template sucessfuly written to {}.' . format ( output_path ) )
Generates C header file from the `template_file`.
Generates C header file from the ` template_file ` .
""" Generates C header file from the `template_file`.

    It produces a list of tuples with a field name and the `MemoryRegion`
    object, whic is used in the `template_path`. The resulting header file is
    placed into `output_path`.
    """
fields
input_dir
output_dir