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>
This commit is contained in:
Shawn Nematbakhsh
2016-08-01 15:09:22 -07:00
committed by chrome-bot
parent 7fbac79e94
commit 8cda422254
2 changed files with 9 additions and 2 deletions

View File

@@ -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

View File

@@ -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;