summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-01-12 09:40:10 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-01-30 16:48:40 -0800
commit7cbb815732d7434f5985d3b50a869aa71ba5c507 (patch)
tree5c8714c956b96cbe3c6793d31b338e68afbacc79 /core
parent927e01da02ab68c304d95508df5ba0b50f8bb960 (diff)
downloadchrome-ec-7cbb815732d7434f5985d3b50a869aa71ba5c507.tar.gz
version: Store image size data in version struct
Store our image size (known at build time) in our version struct (now renamed to image_data). This will allow us to more efficiently determine the size of an image in a follow-up CL. Note that compatibility is broken for old ROs that do not include this CL. BUG=chromium:577915 TEST=Verify on kevin + lars + lars_pd that stored image size matches output of system_get_image_used() for both RO and RW images. BRANCH=None Change-Id: I49ea5fc27a7f11f66daba485a87d0dfe7d0c770f Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/427408 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/ec.lds.S8
-rw-r--r--core/cortex-m0/ec.lds.S4
-rw-r--r--core/nds32/ec.lds.S2
3 files changed, 11 insertions, 3 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 90212a5389..803845c5a6 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -79,7 +79,7 @@ SECTIONS
#endif
STRINGIFY(OUTDIR/core/CORE/init.o) (.text.vecttable)
. = ALIGN(4);
- __version_struct_offset = .;
+ __image_data_offset = .;
KEEP(*(.rodata.ver))
. = ALIGN(4);
@@ -357,6 +357,12 @@ SECTIONS
) >= (LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)),
"No room left in the flash")
+#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_USB_RAM_SIZE
.usb_ram (NOLOAD) : {
__usb_ram_start = .;
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index 6102bfa973..ee65cb31ce 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -41,7 +41,7 @@ SECTIONS
.text : {
STRINGIFY(OUTDIR/core/CORE/init.o) (.text.vecttable)
. = ALIGN(4);
- __version_struct_offset = .;
+ __image_data_offset = .;
KEEP(*(.rodata.ver))
. = ALIGN(4);
@@ -245,6 +245,8 @@ SECTIONS
) >= (LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)),
"No room left in the flash")
+ __image_size = __hey_flash_used;
+
#ifdef CONFIG_USB_RAM_SIZE
.usb_ram (NOLOAD) : {
__usb_ram_start = .;
diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S
index 1f125243c9..978f652815 100644
--- a/core/nds32/ec.lds.S
+++ b/core/nds32/ec.lds.S
@@ -36,7 +36,7 @@ SECTIONS
"__flash_dma_start has to be 4k-byte aligned");
KEEP(STRINGIFY(OUTDIR/core/CORE/init.o) (.text.vecttable))
. = ALIGN(4);
- __version_struct_offset = .;
+ __image_data_offset = .;
KEEP(*(.rodata.ver))
. = ALIGN(4);
KEEP(STRINGIFY(OUTDIR/core/CORE/init.o) (.text.vectirq))