Skip to content

Commit 7053ef9

Browse files
Marcelo SalazarMarcelo Salazar
authored andcommitted
memap enhancements with depth level configurable
Removed heap/stack from report Add --stats-depth option to mbed compile Fix minor issues identified in review Fix bug when parsing armcc libs Fix code style Fix minor issues on existing tests Fix memap for automated TESTS Fix stats-depth parameter for tests
1 parent acdd7dd commit 7053ef9

File tree

6 files changed

+595
-337
lines changed

6 files changed

+595
-337
lines changed

tools/build_api.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
446446
macros=None, inc_dirs=None, jobs=1, silent=False,
447447
report=None, properties=None, project_id=None,
448448
project_description=None, extra_verbose=False, config=None,
449-
app_config=None, build_profile=None):
449+
app_config=None, build_profile=None, stats_depth=None):
450450
""" Build a project. A project may be a test or a user program.
451451
452452
Positional arguments:
@@ -475,6 +475,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
475475
config - a Config object to use instead of creating one
476476
app_config - location of a chosen mbed_app.json file
477477
build_profile - a dict of flags that will be passed to the compiler
478+
stats_depth - depth level for memap to display file/dirs
478479
"""
479480

480481
# Convert src_path to a list if needed
@@ -553,18 +554,18 @@ def build_project(src_paths, build_path, target, toolchain_name,
553554
memap_table = ''
554555
if memap_instance:
555556
# Write output to stdout in text (pretty table) format
556-
memap_table = memap_instance.generate_output('table')
557+
memap_table = memap_instance.generate_output('table', stats_depth)
557558

558559
if not silent:
559560
print memap_table
560561

561562
# Write output to file in JSON format
562563
map_out = join(build_path, name + "_map.json")
563-
memap_instance.generate_output('json', map_out)
564+
memap_instance.generate_output('json', stats_depth, map_out)
564565

565566
# Write output to file in CSV format for the CI
566567
map_csv = join(build_path, name + "_map.csv")
567-
memap_instance.generate_output('csv-ci', map_csv)
568+
memap_instance.generate_output('csv-ci', stats_depth, map_csv)
568569

569570
resources.detect_duplicates(toolchain)
570571

@@ -1163,7 +1164,7 @@ def mcu_toolchain_list(release_version='5'):
11631164

11641165

11651166
def mcu_target_list(release_version='5'):
1166-
""" Shows target list
1167+
""" Shows target list
11671168
11681169
"""
11691170

tools/make.py

Lines changed: 63 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -58,51 +58,66 @@
5858
# Parse Options
5959
parser = get_default_options_parser(add_app_config=True)
6060
group = parser.add_mutually_exclusive_group(required=False)
61-
group.add_argument("-p",
62-
type=argparse_many(test_known),
63-
dest="program",
64-
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
65-
66-
group.add_argument("-n",
67-
type=argparse_many(test_name_known),
68-
dest="program",
69-
help="The name of the desired test program")
70-
71-
parser.add_argument("-j", "--jobs",
72-
type=int,
73-
dest="jobs",
74-
default=0,
75-
help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
76-
77-
parser.add_argument("-v", "--verbose",
78-
action="store_true",
79-
dest="verbose",
80-
default=False,
81-
help="Verbose diagnostic output")
82-
83-
parser.add_argument("--silent",
84-
action="store_true",
85-
dest="silent",
86-
default=False,
87-
help="Silent diagnostic output (no copy, compile notification)")
88-
89-
parser.add_argument("-D",
90-
action="append",
91-
dest="macros",
92-
help="Add a macro definition")
93-
94-
group.add_argument("-S", "--supported-toolchains",
95-
dest="supported_toolchains",
96-
default=False,
97-
const="matrix",
98-
choices=["matrix", "toolchains", "targets"],
99-
nargs="?",
100-
help="Displays supported matrix of MCUs and toolchains")
101-
102-
parser.add_argument('-f', '--filter',
103-
dest='general_filter_regex',
104-
default=None,
105-
help='For some commands you can use filter to filter out results')
61+
group.add_argument(
62+
"-p",
63+
type=argparse_many(test_known),
64+
dest="program",
65+
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
66+
67+
group.add_argument(
68+
"-n",
69+
type=argparse_many(test_name_known),
70+
dest="program",
71+
help="The name of the desired test program")
72+
73+
parser.add_argument(
74+
"-j", "--jobs",
75+
type=int,
76+
dest="jobs",
77+
default=0,
78+
help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
79+
80+
parser.add_argument(
81+
"-v", "--verbose",
82+
action="store_true",
83+
dest="verbose",
84+
default=False,
85+
help="Verbose diagnostic output")
86+
87+
parser.add_argument(
88+
"--silent",
89+
action="store_true",
90+
dest="silent",
91+
default=False,
92+
help="Silent diagnostic output (no copy, compile notification)")
93+
94+
parser.add_argument(
95+
"-D",
96+
action="append",
97+
dest="macros",
98+
help="Add a macro definition")
99+
100+
group.add_argument(
101+
"-S", "--supported-toolchains",
102+
dest="supported_toolchains",
103+
default=False,
104+
const="matrix",
105+
choices=["matrix", "toolchains", "targets"],
106+
nargs="?",
107+
help="Displays supported matrix of MCUs and toolchains")
108+
109+
parser.add_argument(
110+
'-f', '--filter',
111+
dest='general_filter_regex',
112+
default=None,
113+
help='For some commands you can use filter to filter out results')
114+
115+
parser.add_argument(
116+
"--stats-depth",
117+
type=int,
118+
dest="stats_depth",
119+
default=2,
120+
help="Depth level for static memory report")
106121

107122
# Local run
108123
parser.add_argument("--automated", action="store_true", dest="automated",
@@ -277,7 +292,8 @@
277292
inc_dirs=[dirname(MBED_LIBRARIES)],
278293
build_profile=extract_profile(parser,
279294
options,
280-
toolchain))
295+
toolchain),
296+
stats_depth=options.stats_depth)
281297
print 'Image: %s'% bin_file
282298

283299
if options.disk:
@@ -322,7 +338,7 @@
322338
traceback.print_exc(file=sys.stdout)
323339
else:
324340
print "[ERROR] %s" % str(e)
325-
341+
326342
sys.exit(1)
327343
if options.build_data:
328344
merge_build_data(options.build_data, build_data_blob, "application")

0 commit comments

Comments
 (0)