diff options
author | Caveh Jalali <caveh@chromium.org> | 2020-09-24 03:39:30 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-25 05:51:25 +0000 |
commit | 17cb616f9d7a0d4eabfcc3bd7a7f97ce36f4c834 (patch) | |
tree | 60a4159a4d09bfe339036edc0522ccd9c031762e /core | |
parent | 8012d164fe7a2c4fc53fe0495bac137d5b32c5ae (diff) | |
download | chrome-ec-17cb616f9d7a0d4eabfcc3bd7a7f97ce36f4c834.tar.gz |
coretex-m: fix __image_size value in linker script
This fixes a regression introduced by chromiun:2325768 that broke
software sync and forced recovery mode due to an incorrect EC image
size value when CONFIG_CHIP_DATA_IN_INIT_ROM is used.
also, __image_size was set twice in the linker script with the latter
taking precedence when CONFIG_CHIP_INIT_ROM_REGION is enabled. Made
the 1st occurrence conditional to avoid confusion.
BUG=none
BRANCH=none
TEST=EC console "hash" command now reports the correct image size and
we no longer end up in recovery due to software sync.
Change-Id: Ic0fb405f6918bdfa467be5919eed91eb17ef7c2a
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2428566
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/cortex-m/ec.lds.S | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index dede2bd3d1..2314156294 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -495,7 +495,9 @@ SECTIONS * in hash calcuations. */ __flash_used = FLASH_USED_END - ORIGIN(EC_IMAGE_LMA_MEM_REGION); +#ifndef CONFIG_CHIP_INIT_ROM_REGION __image_size = __flash_used; +#endif /* CONFIG_CHIP_INIT_ROM_REGION */ #ifdef CONFIG_FLASH /* @@ -600,7 +602,11 @@ SECTIONS * CONFIG_CHIP_INIT_ROM_REGION is enabled, this includes the entire * FLASH region and the bytes used in the .init_rom section. */ +#ifdef CONFIG_CHIP_DATA_IN_INIT_ROM + __image_size = LENGTH(FLASH) + SIZEOF(.init_rom) + SIZEOF(.data); +#else __image_size = LENGTH(FLASH) + SIZEOF(.init_rom); +#endif /* CONFIG_CHIP_DATA_IN_INIT_ROM */ #endif /* CONFIG_CHIP_INIT_ROM_REGION */ #ifdef CONFIG_CHIP_MEMORY_REGIONS |