summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-05-08 15:11:49 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-11 18:38:30 +0000
commit1f09bd7c469fdede4f72425911b0a9d15a439c00 (patch)
tree2879d7d5b6af857c5d72818d899775cf6ea3c434 /Makefile.rules
parentd7d6e7e660901fb73275ca41090115bed590e137 (diff)
downloadchrome-ec-1f09bd7c469fdede4f72425911b0a9d15a439c00.tar.gz
make: add generation of sorted symbol mapsstabilize-7059.B
Sorted symbol maps are useful when one wants to look up an address to associate it with a function or a variable, or to estimate how much room certain components of the image take. This patch adds a rule and creates a dependency to make sure that sorted maps (assigned extension .smap) are generated during builds. BRANCH=none BUG=none TEST=make buildall -j observed 91 .elf files and 89 .smap files generated. the two images not triggering .smap file generation are build/npcx_evb/chip/npcx/lfw/ec_lfw build/npcx_evb/chip/npcx/spiflashfw/ec_npcxflash they could be added in a follow up patch if deemed necessary. Change-Id: I196a2ffe059a83481b7a313617d516634762dc60 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/270117 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules12
1 files changed, 8 insertions, 4 deletions
diff --git a/Makefile.rules b/Makefile.rules
index b129550199..958e116311 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -40,12 +40,13 @@ cmd_lds = $(CPP) -P -C -MMD -MF $@.d -MT $@ $(CPPFLAGS) \
cmd_obj_to_bin ?= $(OBJCOPY) --gap-fill=0xff -O binary $^ $(out)/$*.bin.tmp
cmd_flat_to_obj = $(CC) -T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \
-Wl,--build-id=none -o $@ $<
-cmd_elf_to_flat = $(OBJCOPY) -O binary $^ $@
+cmd_elf_to_flat = $(OBJCOPY) -O binary $< $@
cmd_elf_to_dis = $(OBJDUMP) -D $< > $@
-cmd_elf_to_hex = $(OBJCOPY) -O ihex $^ $@
+cmd_elf_to_hex = $(OBJCOPY) -O ihex $< $@
cmd_bin_to_hex = $(OBJCOPY) -I binary -O ihex \
--change-addresses $(_flash_base) $^ $@
cmd_elf = $(LD) $(objs) $(LDFLAGS) -o $@ -T $< -Map $(out)/$*.map
+cmd_smap = $(NM) $< | sort > $@
cmd_exe = $(CC) $(objs) $(HOST_TEST_LDFLAGS) -o $@
cmd_c_to_o = $(CC) $(CFLAGS) -MMD -MF $@.d -c $< -o $@
cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) \
@@ -170,10 +171,10 @@ $(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds $(flat-y)
$(out)/%.dis: $(out)/%.elf
$(call quiet,elf_to_dis,OBJDUMP)
-$(out)/%.flat: $(out)/%.elf
+$(out)/%.flat: $(out)/%.elf $(out)/%.smap
$(call quiet,elf_to_flat,OBJCOPY)
-$(out)/%.hex: $(out)/%.elf
+$(out)/%.hex: $(out)/%.elf $(out)/%.smap
$(call quiet,elf_to_hex,OBJCOPY)
$(out)/$(PROJECT).hex: $(out)/$(PROJECT).bin
@@ -182,6 +183,9 @@ $(out)/$(PROJECT).hex: $(out)/$(PROJECT).bin
$(out)/%.elf: $(out)/%.lds $(objs)
$(call quiet,elf,LD )
+$(out)/%.smap: $(out)/%.elf
+ $(call quiet,smap,NM )
+
$(out)/$(PROJECT).exe: $(objs)
$(call quiet,exe,EXE )