summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorChe-yu Wu <cheyuw@google.com>2017-08-14 11:46:29 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-08-15 00:25:20 -0700
commit64ecddfd861002cb5cff04b22211d23cf5fbcb5d (patch)
treedf0868c2ebd61189da143727f68f0f21f4ae2028 /Makefile.rules
parentd2a06c36b13d62ef47e625067a4b7747bcf1a8f1 (diff)
downloadchrome-ec-64ecddfd861002cb5cff04b22211d23cf5fbcb5d.tar.gz
ec: Add a task information library for the stack analyzer.
Add a shared library to export task information. Modified the stack analyzer to get information from the shared library. Show allocated stack sizes of tasks in the stack analyzer. To get the all task information (including the allocated stack size), A shared library is added and compiled with the board to export all configurations of the tasklist. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ ./build/elm/RW/ec.RW.elf make BOARD=${BOARD} SECTION=${SECTION} analyzestack Change-Id: I72f01424142bb0a99c6776a55735557308e2cab6 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/611693 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules23
1 files changed, 9 insertions, 14 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 3be6a64582..4256f921ee 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -94,10 +94,11 @@ cmd_sharedlib_elf = $(CC) $(libsharedobjs_deps) \
-Wl,-T,common/ec.$(SHOBJLIB).ld $(LDFLAGS) \
-o $(out)/$(SHOBJLIB)/$(SHOBJLIB).elf \
-Wl,-Map,$(out)/$(SHOBJLIB)/$(SHOBJLIB).map
-cmd_taskinfo = $(CPP) -P -DSECTION_IS_$(3) \
- -I$(BDIR) -DBOARD_$(UC_BOARD) -D_MAKEFILE_DUMP_INFO \
- -imacros $(PROJECT).tasklist include/task_filter.h \
- -o $@
+cmd_c_to_taskinfo = $(BUILDCC) \
+ $(filter-out -DSECTION_IS_$(BLD),$(BUILD_CFLAGS)) -DSECTION_IS_$(3) \
+ -MMD -MF $@.d -c $< -flto -o $@
+cmd_link_taskinfo = $(BUILDCC) $(BUILD_CFLAGS) --shared -fPIC $^ \
+ $(BUILD_LDFLAGS) -flto -o $@
# commands for RSA signature: rwsig does not need to sign the whole image
# (it signs the RW part separately). usbpd1 type needs to sign the final image.
@@ -427,13 +428,6 @@ $(npcx-flash-fw-bin):
-Wl,-Map,$(out)/$(npcx-flash-fw).map
-@ $(OBJCOPY) -O binary $(out)/$(npcx-flash-fw).elf $@
-# Update taskinfo when the ec.tasklist is modified.
-$(out)/RO/%.taskinfo: $(BDIR)/$(PROJECT).tasklist
- $(call quiet,taskinfo,TSKINFO,RO)
-
-$(out)/RW/%.taskinfo: $(BDIR)/$(PROJECT).tasklist
- $(call quiet,taskinfo,TSKINFO,RW)
-
.PHONY: xrefs
xrefs: $(call targ_if_prog,etags,$(out)/TAGS) \
$(call targ_if_prog,ctags,$(out)/tags)
@@ -547,19 +541,20 @@ newsizes:
# them first is because elf dependencies will cause the elf files be rebuilt for
# updating date, which shouldn't happen when analyzing the existing firmwares.
.PHONY: analyzestack
-analyzestack: $(out)/RO/ec.RO.taskinfo $(out)/RW/ec.RW.taskinfo
+analyzestack: $(out)/util/export_taskinfo.so
@if [ "$(SECTION)" != "RO" ] && [ "$(SECTION)" != "RW" ]; then \
echo "Please specify SECTION=RO or RW. The default is RW."; \
SECTION="RW"; \
fi; \
ELF=$(out)/$$SECTION/ec.$$SECTION.elf; \
- TASKLIST=$(out)/$$SECTION/ec.$$SECTION.taskinfo; \
+ EXPORT_TASKINFO=$(out)/util/export_taskinfo.so; \
if [ ! -f "$$ELF" ]; then \
echo "Some files are missing. Are they built?"; \
exit 1; \
fi; \
extra/stack_analyzer/stack_analyzer.py --objdump "$(OBJDUMP)" \
- --addr2line "$(ADDR2LINE)" "$$ELF" "$$TASKLIST"
+ --addr2line "$(ADDR2LINE)" --section "$$SECTION" \
+ --export_taskinfo "$$EXPORT_TASKINFO" "$$ELF"
.SECONDARY: