summaryrefslogtreecommitdiff
path: root/util
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 /util
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 'util')
-rw-r--r--util/build.mk11
-rw-r--r--util/export_taskinfo.c43
2 files changed, 54 insertions, 0 deletions
diff --git a/util/build.mk b/util/build.mk
index 8708c0eb89..95ded5724b 100644
--- a/util/build.mk
+++ b/util/build.mk
@@ -9,6 +9,7 @@
host-util-bin=ectool lbplay stm32mon ec_sb_firmware_update lbcc \
ec_parse_panicinfo
build-util-bin=ec_uartd iteflash
+build-util-art+=util/export_taskinfo.so
ifeq ($(CHIP),npcx)
build-util-bin+=ecst
endif
@@ -37,3 +38,13 @@ $(out)/util/usb_pd_policy.o: board/$(BOARD)/usb_pd_policy.c
$(call quiet,c_to_vif,BUILDCC)
deps += $(out)/util/usb_pd_policy.o.d
endif # CONFIG_USB_POWER_DELIVERY
+
+$(out)/util/export_taskinfo.so: $(out)/util/export_taskinfo_ro.o \
+ $(out)/util/export_taskinfo_rw.o
+ $(call quiet,link_taskinfo,BUILDLD)
+
+$(out)/util/export_taskinfo_ro.o: util/export_taskinfo.c
+ $(call quiet,c_to_taskinfo,BUILDCC,RO)
+
+$(out)/util/export_taskinfo_rw.o: util/export_taskinfo.c
+ $(call quiet,c_to_taskinfo,BUILDCC,RW)
diff --git a/util/export_taskinfo.c b/util/export_taskinfo.c
new file mode 100644
index 0000000000..b6b9bea7b8
--- /dev/null
+++ b/util/export_taskinfo.c
@@ -0,0 +1,43 @@
+/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * The cmd_c_to_taskinfo will compile this file with different
+ * section definitions to export different tasklists.
+ */
+
+#include <stdint.h>
+
+#include "config.h"
+#include "task_id.h"
+
+#ifdef SECTION_IS_RO
+#define GET_TASKINFOS_FUNC get_ro_taskinfos
+#elif defined(SECTION_IS_RW)
+#define GET_TASKINFOS_FUNC get_rw_taskinfos
+#else
+#error "Current section (RO/RW) is not defined."
+#endif
+
+struct taskinfo {
+ char *name;
+ char *routine;
+ uint32_t stack_size;
+};
+
+#define TASK(n, r, d, s) { \
+ .name = #n, \
+ .routine = #r, \
+ .stack_size = s, \
+},
+static const struct taskinfo const taskinfos[] = {
+ CONFIG_TASK_LIST
+};
+#undef TASK
+
+uint32_t GET_TASKINFOS_FUNC(const struct taskinfo **infos)
+{
+ *infos = taskinfos;
+ /* Calculate the number of tasks */
+ return sizeof(taskinfos) / sizeof(*taskinfos);
+}