diff options
author | Keith Short <keithshort@chromium.org> | 2020-07-31 16:58:19 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-05 19:58:54 +0000 |
commit | 27fb6197d72e36af030eec3dddce815eead060fe (patch) | |
tree | da89ea10ca152727cec737af4e40fc332bd2c603 /core/cortex-m | |
parent | ffada375c6362de2f80255d6abb8bad35ccc8c0d (diff) | |
download | chrome-ec-27fb6197d72e36af030eec3dddce815eead060fe.tar.gz |
linker: change symbol used to track available flash
Change the linker symbol used to track available flash from __image_size
to __flash_used. __image_size is now only used on the struct image_data
header.
BUG=b:160330682
BRANCH=none
TEST=make buildall
TEST=Run compare_build.sh against the following boards:
cortex-m: volteer (npcx chipset)
cortex-m0: honeybuns (stm32f0 chipset)
minute-ia: not changed
nds32: waddledee (it83xx)
riscv-rv32i: asurada (i8xxx2)
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I94f5b4827cc0da1055520685cfeb1fafc0119e1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2334389
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'core/cortex-m')
-rw-r--r-- | core/cortex-m/ec.lds.S | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index 27d71946e5..c24ee8321b 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -41,7 +41,7 @@ MEMORY */ FLASH_HDR (rx) : ORIGIN = FW_OFF(RO_HDR), LENGTH = FW_SIZE(RO_HDR) FLASH (rx) : ORIGIN = FW_OFF(SECTION) + FW_SIZE(RO_HDR), \ - LENGTH = FW_SIZE(SECTION) + LENGTH = FW_SIZE(SECTION) - FW_SIZE(RO_HDR) #else FLASH (rx) : ORIGIN = FW_OFF(SECTION), LENGTH = FW_SIZE(SECTION) #endif @@ -413,14 +413,12 @@ SECTIONS (__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE); /* - * The linker won't notice if the .data section is too big to fit, - * apparently because we're sending it into IRAM, not FLASH. - * The following symbol isn't used by the code, but running - * "objdump -t *.elf | grep hey" will let us check how much - * flash space we're actually using. The explicit ASSERT afterwards - * will cause the linker to abort if we use too much. + * __flash_used is used in flash free calculations by the makefile. + * __image_size is stored in the struct image_data header and used + * in hash calcuations. */ - __hey_flash_used = LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION); + __flash_used = LOADADDR(.data) + SIZEOF(.data) - ORIGIN(FLASH); + __image_size = __flash_used; #ifdef CONFIG_FLASH /* @@ -433,23 +431,21 @@ SECTIONS __config_ec_writable_storage_size = CONFIG_EC_WRITABLE_STORAGE_SIZE; #endif -#ifdef CONFIG_FLASH_PHYSICAL - ASSERT((FW_SIZE(SECTION) + /* + * The linker won't notice if the .data section is too big to fit, + * apparently because we're sending it into IRAM, not FLASH. + * Verify that all sections linked into the FLASH region will fit. + */ + ASSERT((LENGTH(FLASH) #if defined(CONFIG_RWSIG) && defined(SECTION_IS_RO) - CONFIG_RO_PUBKEY_SIZE #endif #if defined(CONFIG_RWSIG) && defined(SECTION_IS_RW) - CONFIG_RW_SIG_SIZE #endif - ) >= (LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)), + ) >= __flash_used, "No room left in the flash") -#endif /* CONFIG_FLASH_PHYSICAL */ -#if defined(SECTION_IS_RO) && defined(NPCX_RO_HEADER) - __image_size = __hey_flash_used - FW_SIZE(RO_HDR); -#else - __image_size = __hey_flash_used; -#endif #ifdef CONFIG_CHIP_MEMORY_REGIONS #define REGION(name, attr, start, size) \ |