mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
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>
64 lines
1.2 KiB
C
64 lines
1.2 KiB
C
/* Copyright (c) 2013 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.
|
|
*/
|
|
|
|
/* Entry point of unit test executable */
|
|
|
|
#include "console.h"
|
|
#include "flash.h"
|
|
#include "hooks.h"
|
|
#include "keyboard_scan.h"
|
|
#include "stack_trace.h"
|
|
#include "system.h"
|
|
#include "task.h"
|
|
#include "test_util.h"
|
|
#include "timer.h"
|
|
#include "uart.h"
|
|
|
|
/* Console output macros */
|
|
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
|
|
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
|
|
|
|
const char *__prog_name;
|
|
|
|
const char *__get_prog_name(void)
|
|
{
|
|
return __prog_name;
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
__prog_name = argv[0];
|
|
|
|
task_register_tracedump();
|
|
|
|
register_test_end_hook();
|
|
|
|
flash_pre_init();
|
|
system_pre_init();
|
|
system_common_pre_init();
|
|
|
|
test_init();
|
|
|
|
timer_init();
|
|
#ifdef HAS_TASK_KEYSCAN
|
|
keyboard_scan_init();
|
|
#endif
|
|
hook_init();
|
|
uart_init();
|
|
|
|
if (system_jumped_to_this_image()) {
|
|
CPRINTS("Emulator initialized after sysjump");
|
|
} else {
|
|
CPUTS("\n\n--- Emulator initialized after reboot ---\n");
|
|
CPUTS("[Reset cause: ");
|
|
system_print_reset_flags();
|
|
CPUTS("]\n");
|
|
}
|
|
|
|
task_start();
|
|
|
|
return 0;
|
|
}
|