summaryrefslogtreecommitdiff
path: root/util/export_taskinfo.c
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/export_taskinfo.c
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/export_taskinfo.c')
-rw-r--r--util/export_taskinfo.c43
1 files changed, 43 insertions, 0 deletions
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);
+}