tools: Adapt Zephyr/zephyr to Nuttx/nuttx
Adapt Zephyr/zephyr to Nuttx/nuttx Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
87772796e3
commit
5ed85ef476
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2021 Xiaomi Corporation
|
||||
# Copyright (c) 2016, 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
@ -236,7 +237,7 @@ def get_die_filename(die, lineprog):
|
||||
output = Path(args.output)
|
||||
path = output.joinpath(path)
|
||||
|
||||
# Change path to relative to Zephyr base
|
||||
# Change path to relative to Nuttx base
|
||||
try:
|
||||
path = path.resolve()
|
||||
except OSError as e:
|
||||
@ -560,15 +561,15 @@ def generate_any_tree(symbol_dict, total_size, path_prefix):
|
||||
root = TreeNode('Root', "root")
|
||||
node_no_paths = TreeNode('(no paths)', ":", parent=root)
|
||||
|
||||
if Path(path_prefix) == Path(args.zephyrbase):
|
||||
# All source files are under ZEPHYR_BASE so there is
|
||||
if Path(path_prefix) == Path(args.nuttxbase):
|
||||
# All source files are under nuttx_base so there is
|
||||
# no need for another level.
|
||||
node_zephyr_base = root
|
||||
node_nuttx_base = root
|
||||
node_output_dir = root
|
||||
node_workspace = root
|
||||
node_others = root
|
||||
else:
|
||||
node_zephyr_base = TreeNode('ZEPHYR_BASE', args.zephyrbase)
|
||||
node_nuttx_base = TreeNode('nuttx_base', args.nuttxbase)
|
||||
node_output_dir = TreeNode('OUTPUT_DIR', args.output)
|
||||
node_others = TreeNode("/", "/")
|
||||
|
||||
@ -601,7 +602,7 @@ def generate_any_tree(symbol_dict, total_size, path_prefix):
|
||||
|
||||
# Mapping paths to tree nodes
|
||||
path_node_map = [
|
||||
[Path(args.zephyrbase), node_zephyr_base],
|
||||
[Path(args.nuttxbase), node_nuttx_base],
|
||||
[Path(args.output), node_output_dir],
|
||||
]
|
||||
|
||||
@ -633,17 +634,17 @@ def generate_any_tree(symbol_dict, total_size, path_prefix):
|
||||
_insert_one_elem(dest_node, path, size)
|
||||
|
||||
|
||||
if node_zephyr_base is not root:
|
||||
# ZEPHYR_BASE and OUTPUT_DIR nodes don't have sum of symbol size
|
||||
if node_nuttx_base is not root:
|
||||
# nuttx_base and OUTPUT_DIR nodes don't have sum of symbol size
|
||||
# so calculate them here.
|
||||
node_zephyr_base.size = sum_node_children_size(node_zephyr_base)
|
||||
node_nuttx_base.size = sum_node_children_size(node_nuttx_base)
|
||||
node_output_dir.size = sum_node_children_size(node_output_dir)
|
||||
|
||||
# Find out which nodes need to be in the tree.
|
||||
# "(no path)", ZEPHYR_BASE nodes are essential.
|
||||
children = [node_no_paths, node_zephyr_base]
|
||||
# "(no path)", nuttx_base nodes are essential.
|
||||
children = [node_no_paths, node_nuttx_base]
|
||||
if node_output_dir.height != 0:
|
||||
# OUTPUT_DIR may be under ZEPHYR_BASE.
|
||||
# OUTPUT_DIR may be under nuttx_base.
|
||||
children.append(node_output_dir)
|
||||
if node_others.height != 0:
|
||||
# Only include "others" node if there is something.
|
||||
@ -708,9 +709,9 @@ def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("-k", "--kernel", required=True,
|
||||
help="Zephyr ELF binary")
|
||||
parser.add_argument("-z", "--zephyrbase", required=True,
|
||||
help="Zephyr base path")
|
||||
help="Nuttx ELF binary")
|
||||
parser.add_argument("-z", "--nuttxbase", required=True,
|
||||
help="Nuttx base path")
|
||||
parser.add_argument("-q", "--quiet", action="store_true",
|
||||
help="Do not output anything on the screen.")
|
||||
parser.add_argument("-o", "--output", required=True,
|
||||
|
Loading…
Reference in New Issue
Block a user