summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2014-12-10 18:53:59 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-16 22:47:50 +0000
commit07203ac931d5cbe79ad33f1ec9193678c8c540bd (patch)
treed25bacf04bb725be7a2137f37deb79b7cdbf0a0e
parentcf2883afe0ee144029582b62c005c79217905bf3 (diff)
downloadchrome-ec-07203ac931d5cbe79ad33f1ec9193678c8c540bd.tar.gz
Add config option to reduce GPIO name string size.
In order to reduce flash size on some constrained boards this CL modifies the GPIO macro in gpio_list.h to change the name field from that listed 'name' to the concat of 'port' and 'pin'. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:34489 TEST=manual 1. build with and without CONFIG_COMMON_GPIO_SHORTNAMES See 897 bytes savings with config option 2. See reduced names for gpioget > gpioget 0 E6 0 F2 1 B0 Change-Id: Ife1e1e2bcfa620ba87fe6c1ce2b47fe258c46514 Reviewed-on: https://chromium-review.googlesource.com/234587 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--board/samus_pd/board.h1
-rw-r--r--include/config.h6
-rw-r--r--include/gpio_list.h5
3 files changed, 12 insertions, 0 deletions
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index bcfb2e96b7..931876df27 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -21,6 +21,7 @@
#define CONFIG_CHARGE_MANAGER
/* Minimum ilim = 500 mA */
#define CONFIG_CHARGER_INPUT_CURRENT PWM_0_MA
+#define CONFIG_COMMON_GPIO_SHORTNAMES
#undef CONFIG_CONSOLE_CMDHELP
#define CONFIG_FORCE_CONSOLE_RESUME
#define CONFIG_HIBERNATE_WAKEUP_PINS (STM32_PWR_CSR_EWUP3|STM32_PWR_CSR_EWUP8)
diff --git a/include/config.h b/include/config.h
index d48b16dbac..ac936f61ba 100644
--- a/include/config.h
+++ b/include/config.h
@@ -349,6 +349,12 @@
#define CONFIG_COMMON_GPIO
/*
+ * Provides smaller GPIO names to reduce flash size. Instead of the 'name'
+ * field in GPIO macro it will concat 'port' and 'pin' to reduce flash size.
+ */
+#undef CONFIG_COMMON_GPIO_SHORTNAMES
+
+/*
* Provide common runtime layer code (tasks, hooks ...)
* You want this unless you are doing a really tiny firmware.
*/
diff --git a/include/gpio_list.h b/include/gpio_list.h
index 4ea1da27a3..c7e2962747 100644
--- a/include/gpio_list.h
+++ b/include/gpio_list.h
@@ -3,8 +3,13 @@
* found in the LICENSE file.
*/
+#ifdef CONFIG_COMMON_GPIO_SHORTNAMES
+#define GPIO(name, port, pin, flags, signal) \
+ {#port#pin, GPIO_##port, (1 << pin), flags, signal},
+#else
#define GPIO(name, port, pin, flags, signal) \
{#name, GPIO_##port, (1 << pin), flags, signal},
+#endif
#define UNIMPLEMENTED(name) \
{#name, DUMMY_GPIO_BANK, 0, GPIO_DEFAULT, NULL},