summaryrefslogtreecommitdiff
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
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>
-rw-r--r--board/kevin/board.h4
-rw-r--r--common/flash.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/board/kevin/board.h b/board/kevin/board.h
index 12ac648d06..f22812dd89 100644
--- a/board/kevin/board.h
+++ b/board/kevin/board.h
@@ -29,9 +29,9 @@
/*
* We are code space-constrained on kevin, so take 10K that is normally used
- * as data RAM (was 30K, now 20K) and use it for code RAM (was 96K, now 106K)
+ * as data RAM (was 30K, now 22K) and use it for code RAM (was 96K, now 104K)
*/
-#define RAM_SHIFT_SIZE (10 * 1024)
+#define RAM_SHIFT_SIZE (8 * 1024)
#undef CONFIG_RO_SIZE
#define CONFIG_RO_SIZE (NPCX_PROGRAM_MEMORY_SIZE + RAM_SHIFT_SIZE)
#undef CONFIG_RAM_BASE
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;