summaryrefslogtreecommitdiff
path: root/common/flash.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-08-01 15:09:22 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-01 22:20:29 -0700
commit8cda422254d468b1b4ce3ef413262bdaecf816ec (patch)
treefe309eddc8be93dbcf99b98399402fff7466af85 /common/flash.c
parent7fbac79e9473a7766c38e682f4b0212d0aec553b (diff)
downloadchrome-ec-8cda422254d468b1b4ce3ef413262bdaecf816ec.tar.gz
gru: Align images sizes to flash block erase size
Image sizes must be aligned to block erase size to ensure that the host can erase the entire image and nothing but the image. BUG=chrome-os-partner:55828 BRANCH=None TEST=Manual on kevin, rebuild FW with new EC, rebuild + flash EC once again, verify that SW sync completes and unit boots to OS. Change-Id: If6110f39869d6421038a3fe7afdc7d918323249e Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/365142 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/flash.c')
-rw-r--r--common/flash.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/flash.c b/common/flash.c
index 2bb1679197..cffae7843e 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -952,6 +952,13 @@ DECLARE_HOST_COMMAND(EC_CMD_FLASH_WRITE,
flash_command_write,
EC_VER_MASK(0) | EC_VER_MASK(EC_VER_FLASH_WRITE));
+/*
+ * Make sure our image sizes are a multiple of flash block erase size so that
+ * the host can erase the entire image.
+ */
+BUILD_ASSERT(CONFIG_RO_SIZE % CONFIG_FLASH_ERASE_SIZE == 0);
+BUILD_ASSERT(CONFIG_RW_SIZE % CONFIG_FLASH_ERASE_SIZE == 0);
+
static int flash_command_erase(struct host_cmd_handler_args *args)
{
const struct ec_params_flash_erase *p = args->params;