summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-05-19 15:03:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:32:17 +0000
commitffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch)
tree362dd0ba205731aa07be97dd35b44b237799b23b /core
parent478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff)
downloadchrome-ec-ffac23c0ea1bd4ff4568f5bd709a98f912b833a7.tar.gz
Add cprints() and ccprints()
Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/task.c2
-rw-r--r--core/cortex-m0/task.c2
-rw-r--r--core/host/main.c4
-rw-r--r--core/nds32/task.c4
4 files changed, 6 insertions, 6 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 980c4b38c5..e031d58c04 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -77,7 +77,7 @@ void __idle(void)
static void task_exit_trap(void)
{
int i = task_get_current();
- cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]);
+ cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]);
/* Exited tasks simply sleep forever */
while (1)
task_wait_event(-1);
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index 95b758abb8..830d6a520c 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -77,7 +77,7 @@ void __idle(void)
static void task_exit_trap(void)
{
int i = task_get_current();
- cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]);
+ cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]);
/* Exited tasks simply sleep forever */
while (1)
task_wait_event(-1);
diff --git a/core/host/main.c b/core/host/main.c
index fa5077b33d..80c2f33bf5 100644
--- a/core/host/main.c
+++ b/core/host/main.c
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
const char *__prog_name;
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
uart_init();
if (system_jumped_to_this_image()) {
- CPRINTF("[%T Emulator initialized after sysjump]\n");
+ CPRINTS("Emulator initialized after sysjump");
} else {
CPUTS("\n\n--- Emulator initialized after reboot ---\n");
CPUTS("[Reset cause: ");
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 9fe371e716..fc167da878 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -59,7 +59,7 @@ void __idle(void)
* so this only starts once all other tasks have gotten a chance to do
* their task inits and have gone to sleep.
*/
- cprintf(CC_TASK, "[%T idle task started]\n");
+ cprints(CC_TASK, "idle task started");
while (1) {
/*
@@ -74,7 +74,7 @@ void __idle(void)
static void task_exit_trap(void)
{
int i = task_get_current();
- cprintf(CC_TASK, "[%T Task %d (%s) exited!]\n", i, task_names[i]);
+ cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]);
/* Exited tasks simply sleep forever */
while (1)
task_wait_event(-1);