summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian J. Nemec <bnemec@chromium.org>2021-01-27 18:26:20 -0800
committerBrian Nemec <bnemec@chromium.org>2021-01-29 13:02:44 +0000
commita9474d0ebcf47fe02952173b81e2fab1cdbd26c8 (patch)
treeba590a5dbbdfe1d040175b4bc2ff687211b42c82
parent571b25190bc6026070d9aba4a1c107d9893a1b95 (diff)
downloadchrome-ec-a9474d0ebcf47fe02952173b81e2fab1cdbd26c8.tar.gz
Servo_V4: Remove unused commands to save flash space
Servo_V4 shares common code with the rest of the EC. Flash space slowly increases as features are enabled and added. This removes several large commands which are unused by the Servo_V4 flow to free up space. Initial Capacity: 36 bytes in flash and 1684 bytes in RAM still available on servo_v4 RO 4520 bytes in flash and 1684 bytes in RAM still available on servo_v4 RW Changes: * Removed chgsup: 128 byte removed from RO * Removed usart_info: 192 byte removed from RO * Removed flashwp: 320 byte removed from RO * Added new guard CONFIG_CMD_FLASH_WP which is enabled by default and disabled on Servo_v4 Due to reorganization that occurs, the total improvement is not equal to the sum of the changes, the RO region which increased by 576 bytes and RW increased by 592 bytes. Final Capacity: 612 bytes in flash and 1684 bytes in RAM still available on servo_v4 RO 5112 bytes in flash and 1684 bytes in RAM still available on servo_v4 RW BUG=b:178186394 TEST=Searched autotest, hdctool, and ec/util directories for references to the above commands. Validated cases have no usages or in the case of the flashwp command is used only by the EC rather than the Servo. TEST=Validated commands are not used in update process. Updates to and from these images are successful. TEST=Validated basic servo functionality is working BRANCH=Servo Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: Ib9c4e92c723e9eea3d0f403e1eb46556e3984074 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654610 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
-rw-r--r--board/servo_v4/board.h3
-rw-r--r--common/flash.c2
-rw-r--r--include/config.h7
3 files changed, 12 insertions, 0 deletions
diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h
index 5fcb14e527..5583af223d 100644
--- a/board/servo_v4/board.h
+++ b/board/servo_v4/board.h
@@ -89,12 +89,15 @@
#undef CONFIG_CMD_ACCELSPOOF
#undef CONFIG_CMD_FASTCHARGE
#undef CONFIG_CMD_FLASHINFO
+#undef CONFIG_CMD_FLASH_WP
#undef CONFIG_CMD_GETTIME
#undef CONFIG_CMD_MEM
#undef CONFIG_CMD_SHMEM
#undef CONFIG_CMD_SYSLOCK
#undef CONFIG_CMD_TIMERINFO
#undef CONFIG_CMD_WAITMS
+#undef CONFIG_CMD_USART_INFO
+#undef CONFIG_CMD_CHARGE_SUPPLIER_INFO
/* Enable control of I2C over USB */
#define CONFIG_USB_I2C
diff --git a/common/flash.c b/common/flash.c
index 9f222f55b0..f2f402c156 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -1156,6 +1156,7 @@ DECLARE_CONSOLE_COMMAND(flashread, command_flash_read,
"Read flash");
#endif
+#ifdef CONFIG_CMD_FLASH_WP
static int command_flash_wp(int argc, char **argv)
{
int val;
@@ -1204,6 +1205,7 @@ DECLARE_CONSOLE_COMMAND(flashwp, command_flash_wp,
" | rb | norb"
#endif
, "Modify flash write protect");
+#endif /* CONFIG_CMD_FLASH_WP */
/*****************************************************************************/
/* Host commands */
diff --git a/include/config.h b/include/config.h
index d5245403e3..a7177856b3 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1772,6 +1772,13 @@
#undef CONFIG_FLASH_PROTECT_RW
/*
+ * Enable Flash Write Protect by default. Some platforms like Servo_v4
+ * development tools do not use write protection. This enables the feature
+ * to be removed to save flash space
+ */
+#define CONFIG_CMD_FLASH_WP
+
+/*
* Store persistent write protect for the flash inside the flash data itself.
* This allows ECs with internal flash to emulate something closer to a SPI
* flash write protect register. If this is not defined, write protect state