diff options
author | Yilun Lin <yllin@google.com> | 2019-04-29 16:51:19 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-07 17:22:47 -0700 |
commit | 46f9db386e7956ca1279e2b0ff28d4bb30aef40c (patch) | |
tree | 1200677e687b80592fcb8b3126163674c966b08f | |
parent | 4d7176961b5e2409a84786511076fe5147ccda71 (diff) | |
download | chrome-ec-46f9db386e7956ca1279e2b0ff28d4bb30aef40c.tar.gz |
cortex-m/ec.lds.S: Workaround for ld not complaining LMA overlapping.
ld won't complain .data LMA overlapping if using a computed LMA
address. This CL workaround this by assigning a load memory region.
Related discussion:
https://github.com/rust-embedded/cortex-m-rt/issues/86
TEST=make buildall -j
TEST=cherry-pick https://crrev.com/c/1592972
make BOARD=kukui_scp -j
and see it ld reports failure for LMA overlapping:
build/kukui_scp/RW/ec.RW.elf section `.data' will not fit in region `IROM'
region `IROM' overflowed by 3784 bytes
TEST=w/o this CL; make buildall -j; cp -r build build.old
w/ this CL; comment out EC version rules
#.PHONY: $(out)/ec_version.h
make buildall -j
compares the .flat files by:
for f in $(ls build/*/*/ec.*.flat | sed -e 's|build/||');
do
echo "###### diff ${f}"
diff <(xxd build/${f}) <(xxd build.old/${f})
done
and see that all the .flat are the same, except that
some boards(aquila, arcadia, cr5*, granite,
haven_dev, hg_*, hotelgolf, hslt_*, indus, proto2, red,
starcard, tk-x001) using g-chip have different content at
addr 0x0~0x360 (related to regen key?), and this change
is not likely to touch that address.
BUG=b:131641213
BRANCH=None
Change-Id: I54c697669ef3836c93027bce90f507c33283c6f3
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1588297
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | core/cortex-m/ec.lds.S | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index bb6b5ed84a..2b6d39c060 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -19,6 +19,9 @@ #define FW_SIZE_(section) CONFIG_##section##_SIZE #define FW_SIZE(section) FW_SIZE_(section) +/* Indicates where .data LMA should reside. */ +#undef DATA_LMA_MEM_REGION + OUTPUT_FORMAT(BFD_FORMAT, BFD_FORMAT, BFD_FORMAT) OUTPUT_ARCH(BFD_ARCH) ENTRY(reset) @@ -266,10 +269,13 @@ SECTIONS . = ALIGN(4); #if !defined(CONFIG_FLASH_PHYSICAL) } > IROM +#define DATA_LMA_MEM_REGION IROM #elif defined(CONFIG_EXTERNAL_STORAGE) } > CDRAM AT > FLASH +#define DATA_LMA_MEM_REGION FLASH #else } > FLASH +#define DATA_LMA_MEM_REGION FLASH #endif __data_lma_start = .; @@ -328,11 +334,7 @@ SECTIONS } > IRAM #endif /* defined(CONFIG_REPLACE_LOADER_WITH_BSS_SLOW) */ -#ifdef CONFIG_EXTERNAL_STORAGE - .data : AT(LOADADDR(.rodata) + SIZEOF(.rodata)) { -#else - .data : AT(ADDR(.rodata) + SIZEOF(.rodata)) { -#endif + .data : { . = ALIGN(4); __data_start = .; *(.data.tasks) @@ -374,7 +376,7 @@ SECTIONS __shared_mem_buf = .; /* NOTHING MAY GO AFTER THIS! */ - } > IRAM + } > IRAM AT > DATA_LMA_MEM_REGION ASSERT((__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE) <= (CONFIG_RAM_BASE + CONFIG_RAM_SIZE), |