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