diff options
author | Bill Richardson <wfrichar@chromium.org> | 2012-05-18 18:55:52 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2012-05-21 14:20:02 -0700 |
commit | add419009fe4f9f6a9f11780a582657c7805d6f0 (patch) | |
tree | e0d22b86c569cad9d42a39e981a440b72f7c712d /common/firmware_image.lds.S | |
parent | 1ac197d566d74b5dfd2abbd57c191e464aa46d8b (diff) | |
download | chrome-ec-add419009fe4f9f6a9f11780a582657c7805d6f0.tar.gz |
Clean up linker scripts; detect out-of-flash problem.
The VMA of the .data segment is in RAM, but we actually put it into FLASH.
The linker doesn't notice if it runs out of flash, so it creates an invalid
image.
This adds an explicit check to be sure it all fits. It also refactors the
region declarations to be more explicit. For vboot-enabled configurations,
CONFIG_SECTION_* - describes the extent of flash for one entire image
CONFIG_FW_* - the region within the SECTION for the firmware only
CONFIG_VBLOCK_* - the region within the RW SECTIONs for the vblocks
CONFIG_VBOOT_ROOTKEY - the region within the RO SECTION for the root key
Look at chip/lm4/config.h for the best example.
BUG=chrome-os-partner:9839
TEST=manual
Build it, run it.
Change-Id: I3c652e82d58a5328115cc750c80ecba6a3fd99a3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/firmware_image.lds.S')
-rw-r--r-- | common/firmware_image.lds.S | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/common/firmware_image.lds.S b/common/firmware_image.lds.S index 98bbb7cb62..cf1e79ff39 100644 --- a/common/firmware_image.lds.S +++ b/common/firmware_image.lds.S @@ -14,23 +14,22 @@ MEMORY SECTIONS { . = ALIGN(CONFIG_FLASH_BANK_SIZE); - .image.RO : AT(CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF) { + .image.RO : AT(CONFIG_FLASH_BASE + CONFIG_SECTION_RO_OFF) { *(.image.RO) } > FLASH =0xff . = ALIGN(CONFIG_FLASH_BANK_SIZE); - .image.A : AT(CONFIG_FLASH_BASE + CONFIG_FW_A_OFF) { + .image.A : AT(CONFIG_FLASH_BASE + CONFIG_SECTION_A_OFF) { *(.image.A) BYTE(0xEA) /* Mark end explicitly */ } > FLASH =0xff #ifndef CONFIG_NO_RW_B . = ALIGN(CONFIG_FLASH_BANK_SIZE); - .image.B : AT(CONFIG_FLASH_BASE + CONFIG_FW_B_OFF) { + .image.B : AT(CONFIG_FLASH_BASE + CONFIG_SECTION_B_OFF) { *(.image.B) BYTE(0xEB) /* Mark end explicitly */ } > FLASH =0xff #endif - /* NOTE: EC implementation reserves one bank for itself */ - .padding : AT(CONFIG_FLASH_BASE + CONFIG_FLASH_SIZE - CONFIG_FLASH_BANK_SIZE - 1) { + .padding : AT(CONFIG_FLASH_BASE + CONFIG_FLASH_SIZE - 1) { BYTE(0xff); } > FLASH =0xff } |