Unverified Commit 6698f655 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

nfpvalues, size: handle missing sections in size output

parent d705599e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -24,15 +24,15 @@ def main(size_executable, rom_sections, ram_sections):
    section_size = dict()

    for line in status.stdout.split("\n"):
        match = re.match("[.](\S+)\s+(\d+)", line)
        match = re.match(r"[.](\S+)\s+(\d+)", line)
        if match:
            section = match.group(1)
            size = int(match.group(2))
            section_size[section] = size

    total = {
        "ROM": sum(map(lambda section: section_size[section], rom_sections)),
        "RAM": sum(map(lambda section: section_size[section], ram_sections)),
        "ROM": sum(map(lambda section: section_size.get(section, 0), rom_sections)),
        "RAM": sum(map(lambda section: section_size.get(section, 0), ram_sections)),
    }

    output = {"OS Image": total}
+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ def main(size_executable, rom_sections, ram_sections):
            section_size[section] = size

    total = {
        "ROM": sum(map(lambda section: section_size[section], rom_sections)),
        "RAM": sum(map(lambda section: section_size[section], ram_sections)),
        "ROM": sum(map(lambda section: section_size.get(section, 0), rom_sections)),
        "RAM": sum(map(lambda section: section_size.get(section, 0), ram_sections)),
    }

    output = {"section": section_size, "total": total}