Skip to content

Commit c4986ee

Browse files
committed
Create map file when building
Add compiler flags to ARM, GCC and IAR so map files get created.
1 parent 720e8e7 commit c4986ee

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

tools/toolchains/arm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ def compile_cpp(self, source, object, includes):
157157

158158
@hook_tool
159159
def link(self, output, objects, libraries, lib_dirs, mem_map):
160+
map_file = splitext(output)[0] + ".map"
160161
if len(lib_dirs):
161-
args = ["-o", output, "--userlibpath", ",".join(lib_dirs), "--info=totals", "--list=.link_totals.txt"]
162+
args = ["-o", output, "--userlibpath", ",".join(lib_dirs), "--info=totals", "--map", "--list=%s" % map_file]
162163
else:
163-
args = ["-o", output, "--info=totals", "--list=.link_totals.txt"]
164+
args = ["-o", output, "--info=totals", "--map", "--list=%s" % map_file]
164165

165166
if mem_map:
166167
args.extend(["--scatter", mem_map])

tools/toolchains/gcc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
216216
libs.extend(libs)
217217

218218
# Build linker command
219-
cmd = self.ld + ["-o", output] + objects
219+
map_file = splitext(output)[0] + ".map"
220+
cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects
220221

221222
if mem_map:
222223
cmd.extend(['-T', mem_map])

tools/toolchains/iar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def compile_cpp(self, source, object, includes):
145145
@hook_tool
146146
def link(self, output, objects, libraries, lib_dirs, mem_map):
147147
# Build linker command
148-
cmd = [self.ld, "-o", output, "--skip_dynamic_initialization"] + objects + libraries
148+
map_file = splitext(output)[0] + ".map"
149+
cmd = [self.ld, "-o", output, "--skip_dynamic_initialization", "--map=%s" % map_file] + objects + libraries
149150

150151
if mem_map:
151152
args.extend(["--config", mem_map])

0 commit comments

Comments
 (0)