diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-05-23 14:08:30 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-24 04:10:04 -0700 |
commit | 35e278bb41dc9f54e1317b0225c371b4c939eb12 (patch) | |
tree | c5607de91fb013ce317b3b762532c643c04fb41e | |
parent | 336be875915c5aa0ae285401c0f60d0c93a563ac (diff) | |
download | chrome-ec-35e278bb41dc9f54e1317b0225c371b4c939eb12.tar.gz |
console_output: Add option to disable console channels
On hammer, we do not need the console channels, so we can just
disable them to save flash size.
BRANCH=poppy
BUG=b:35647963
TEST=make newsizes, staff image size shrinks by 704 bytes
Change-Id: I7a493ae57573814b166d45e57f1ad3d885f26086
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070949
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | common/console_output.c | 10 | ||||
-rw-r--r-- | include/config.h | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/common/console_output.c b/common/console_output.c index 7354ea4392..01f60859a4 100644 --- a/common/console_output.c +++ b/common/console_output.c @@ -10,6 +10,7 @@ #include "usb_console.h" #include "util.h" +#ifdef CONFIG_CONSOLE_CHANNEL /* Default to all channels active */ #ifndef CC_DEFAULT #define CC_DEFAULT CC_ALL @@ -34,6 +35,7 @@ static const char * const channel_names[] = { BUILD_ASSERT(ARRAY_SIZE(channel_names) == CC_CHANNEL_COUNT); /* ensure that we are not silently masking additional channels */ BUILD_ASSERT(CC_CHANNEL_COUNT <= 8*sizeof(uint32_t)); +#endif /* CONFIG_CONSOLE_CHANNEL */ /*****************************************************************************/ /* Channel-based console output */ @@ -42,9 +44,11 @@ int cputs(enum console_channel channel, const char *outstr) { int rv1, rv2; +#ifdef CONFIG_CONSOLE_CHANNEL /* Filter out inactive channels */ if (!(CC_MASK(channel) & channel_mask)) return EC_SUCCESS; +#endif rv1 = usb_puts(outstr); rv2 = uart_puts(outstr); @@ -57,9 +61,11 @@ int cprintf(enum console_channel channel, const char *format, ...) int rv1, rv2; va_list args; +#ifdef CONFIG_CONSOLE_CHANNEL /* Filter out inactive channels */ if (!(CC_MASK(channel) & channel_mask)) return EC_SUCCESS; +#endif usb_va_start(args, format); rv1 = usb_vprintf(format, args); @@ -77,9 +83,11 @@ int cprints(enum console_channel channel, const char *format, ...) int r, rv; va_list args; +#ifdef CONFIG_CONSOLE_CHANNEL /* Filter out inactive channels */ if (!(CC_MASK(channel) & channel_mask)) return EC_SUCCESS; +#endif rv = cprintf(channel, "[%T "); @@ -107,6 +115,7 @@ void cflush(void) /*****************************************************************************/ /* Console commands */ +#ifdef CONFIG_CONSOLE_CHANNEL /* Set active channels */ static int command_ch(int argc, char **argv) { @@ -149,3 +158,4 @@ static int command_ch(int argc, char **argv) DECLARE_CONSOLE_COMMAND(chan, command_ch, "[ save | restore | <mask> ]", "Save, restore, get or set console channel mask"); +#endif /* CONFIG_CONSOLE_CHANNEL */ diff --git a/include/config.h b/include/config.h index 1e0097332a..d06cbcf73c 100644 --- a/include/config.h +++ b/include/config.h @@ -945,6 +945,15 @@ /*****************************************************************************/ /* + * Make it possible for console to be output to different channels that can be + * turned on and off. + * + * Boards that do not require a typical FAFT flow may #undef this to reduce + * image size. + */ +#define CONFIG_CONSOLE_CHANNEL + +/* * Provide additional help on console commands, such as the supported * options/usage. * |