diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-12-17 13:08:38 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-12-18 12:43:50 -0800 |
commit | ee4e0763a17908c9cb058bfadaab0ac803062e18 (patch) | |
tree | c827254a14728fa81d0a4d3181c5db2a02629727 | |
parent | 8623942335252b7ec92d587391403ff9f425a007 (diff) | |
download | chrome-ec-ee4e0763a17908c9cb058bfadaab0ac803062e18.tar.gz |
common: Include host/console commands based on HAS_TASK_HOSTCMD/CONSOLE
Don't build a table of host / console commands if the HOSTCMD or CONSOLE
task is not present. This saves space in the .hcmds / .cmds section and
allows the linker to prune command handler functions which will never be
called.
BUG=chrome-os-partner:41959
TEST=Verify ec.RO.flat shrinks on snoball and glados_pd, and remains the
same size on chell and samus. Also verify basic functions are still
working on snoball and glados_pd.
BRANCH=None
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I79975c18ec1d87fedda8d1f299f30ffc43c24f69
Reviewed-on: https://chromium-review.googlesource.com/319112
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | include/console.h | 5 | ||||
-rw-r--r-- | include/host_command.h | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/console.h b/include/console.h index 01cf13d6ea..1f7a24f0f3 100644 --- a/include/console.h +++ b/include/console.h @@ -142,7 +142,10 @@ void console_has_input(void); * @param shorthelp String with one-line description of command. * @param longhelp String with long description of command. */ -#ifdef CONFIG_CONSOLE_CMDHELP +#ifndef HAS_TASK_CONSOLE +#define DECLARE_CONSOLE_COMMAND(name, routine, argdesc, shorthelp, longhelp) \ + int (routine)(int argc, char **argv) __attribute__((unused)) +#elif defined(CONFIG_CONSOLE_CMDHELP) #define DECLARE_CONSOLE_COMMAND(name, routine, argdesc, shorthelp, longhelp) \ static const char __con_cmd_label_##name[] = #name; \ const struct console_command __keep __con_cmd_##name \ diff --git a/include/host_command.h b/include/host_command.h index c987df561b..c9dcd3ddd8 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -194,10 +194,16 @@ int host_request_expected_size(const struct ec_host_request *r); void host_packet_receive(struct host_packet *pkt); /* Register a host command handler */ +#ifdef HAS_TASK_HOSTCMD #define DECLARE_HOST_COMMAND(command, routine, version_mask) \ const struct host_command __keep __host_cmd_##command \ __attribute__((section(".rodata.hcmds"))) \ = {routine, command, version_mask} +#else +#define DECLARE_HOST_COMMAND(command, routine, version_mask) \ + int (routine)(struct host_cmd_handler_args *args) \ + __attribute__((unused)) +#endif /** |