From 1bc906750260edb89df5b120f38b7c1ec268df90 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 31 Aug 2015 15:15:04 -0700 Subject: cortex-m: Fix sysjump to RO with CONFIG_RO_HEAD_ROOM This accounts for the extra head room in the RO image. BRANCH=none BUG=chrome-os-partner:43025, chrome-os-partner:44625 TEST=the cr50 image validates *and jumps to* the RW image at boot. Change-Id: I8c87e7a9e7da187c19f135176ae5144cbc609cb9 Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/296453 Reviewed-by: Randall Spangler Reviewed-by: Vadim Bendebury --- common/system.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/system.c b/common/system.c index de15f62aa3..856f3d981f 100644 --- a/common/system.c +++ b/common/system.c @@ -520,10 +520,17 @@ int system_run_image_copy(enum system_image_copy_t copy) /* Get reset vector */ init_addr = system_get_fw_reset_vector(base); #else - /* Make sure the reset vector is inside the destination image */ +#if defined(CONFIG_RO_HEAD_ROOM) + /* Skip any head room in the RO image */ + if (copy == SYSTEM_IMAGE_RO) + /* Don't change base, though! */ + init_addr = *(uintptr_t *)(base + CONFIG_RO_HEAD_ROOM + 4); + else +#endif init_addr = *(uintptr_t *)(base + 4); #endif #ifndef EMU_BUILD + /* Make sure the reset vector is inside the destination image */ if (init_addr < base || init_addr >= base + get_size(copy)) return EC_ERROR_UNKNOWN; #endif -- cgit v1.2.1