Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions cmake/reports/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ set(flag_for_rom_report rom)
set(flag_for_footprint all)
set(report_depth 99)

if(CONFIG_REPORT_LOWEST_LIMIT)
set(REPORT_LOWEST_LIMIT ${CONFIG_REPORT_LOWEST_LIMIT})
else()
set(REPORT_LOWEST_LIMIT 0)
endif()
if(CONFIG_REPORT_MAX_ITEMS)
set(REPORT_MAX_ITEMS ${CONFIG_REPORT_MAX_ITEMS})
else()
set(REPORT_MAX_ITEMS 0)
endif()
if(DEFINED ZEPHYR_WORKSPACE)
set(workspace_arg "--workspace=${ZEPHYR_WORKSPACE}")
elseif(DEFINED WEST_TOPDIR)
Expand All @@ -21,6 +31,8 @@ foreach(report ram_report rom_report)
-o ${CMAKE_BINARY_DIR}
${workspace_arg}
-d ${report_depth}
-l ${REPORT_LOWEST_LIMIT}
-m ${REPORT_MAX_ITEMS}
${flag_for_${report}}
DEPENDS ${logical_target_for_zephyr_elf}
$<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
Expand Down
23 changes: 23 additions & 0 deletions scripts/footprint/size_report
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,12 @@ def print_any_tree(root, total_size, depth):
"""
Print the symbol tree.
"""
global args
maxItems = None

if args.maxItems and args.maxItems != 0:
maxItems = args.maxItems

print('{:98s} {:>7s} {:>7s} {:11s} {:16s}'.format(
Fore.YELLOW + "Path", "Size", "%", " Address", "Section" + Fore.RESET))
print('=' * 138)
Expand All @@ -760,6 +766,19 @@ def print_any_tree(root, total_size, depth):
s = str(row.node._size).rjust(100-f)
percent = 100 * float(row.node._size) / float(total_size)

if args.lowestLimit and args.lowestLimit != 0:
# If the current symbol's footprint percentage is below the threshold -> skip it
if percent < args.lowestLimit:
continue

# Only print as many items as the user configured
if args.maxItems and args.maxItems != 0:
maxItems -= 1

if maxItems < 0:
break


hex_addr = "-"
section_name = ""
cc = cr = ""
Expand Down Expand Up @@ -805,6 +824,10 @@ def parse_args():
parser.add_argument("-v", "--verbose", action="store_true",
help="Print extra debugging information")
parser.add_argument("--json", help="store results in a JSON file.")
parser.add_argument("-l", "--lowestLimit", dest="lowestLimit",
type=int, default=0, help="set what percentage is the lowest limit for printing a symbol.")
parser.add_argument("-m", "--maxItems", dest="maxItems",
type=int, default=0, help="how many items in total should the script print.")
args = parser.parse_args()


Expand Down
Loading