From c83795fbcb6c19706f4582a216b35ad5e4a0e246 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Sun, 28 Apr 2019 16:50:15 +0800 Subject: chip/(mec1322|mchp): Drop math expressions in MEMORY ORIGIN/LENGTH binutils/ld 2.32 does not allow expressions in MEMORY regions (for some reason 2.31.1 was fine with that). Replace the expression with a constant, and add 2 assertions to check that the values are sane. BRANCH=none BUG=chromium:957361 TEST=make buildall -j with latest coreboot-sdk, no error Change-Id: I679f1a0ff24e96f215a52cdd6f2cde8540901b8e Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1587256 Reviewed-by: Sean Abraham (cherry picked from commit 7e392e80e65c1b80cda4b585a2adc841905b17f1) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1649528 Reviewed-by: Jett Rink Commit-Queue: Jett Rink Tested-by: Jett Rink --- chip/mchp/lfw/ec_lfw.ld | 11 +++++++++-- chip/mec1322/lfw/ec_lfw.ld | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/chip/mchp/lfw/ec_lfw.ld b/chip/mchp/lfw/ec_lfw.ld index 315ad1bcfd..8e8601a5ee 100644 --- a/chip/mchp/lfw/ec_lfw.ld +++ b/chip/mchp/lfw/ec_lfw.ld @@ -14,10 +14,17 @@ */ MEMORY { - VECTOR(r ) : ORIGIN = 0x0E0000, LENGTH = 24 - SRAM (xrw) : ORIGIN = 0x0E0018, LENGTH = 0x1000 - LENGTH(VECTOR) + VECTOR(r ) : ORIGIN = 0x0E0000, LENGTH = 0x18 + SRAM (xrw) : ORIGIN = 0x0E0018, LENGTH = 0xFE8 } +/* + * ld does not allow mathematical expressions in ORIGIN/LENGTH, so check the + * values here. + */ +ASSERT(ORIGIN(VECTOR) + LENGTH(VECTOR) == ORIGIN(SRAM), "Invalid SRAM origin.") +ASSERT(LENGTH(VECTOR) + LENGTH(SRAM) == 0x1000, "Invalid VECTOR+SRAM length.") + /* * The entry point is informative, for debuggers and simulators, * since the Cortex-M vector points to it anyway. diff --git a/chip/mec1322/lfw/ec_lfw.ld b/chip/mec1322/lfw/ec_lfw.ld index adb8b30bba..65e17e4941 100644 --- a/chip/mec1322/lfw/ec_lfw.ld +++ b/chip/mec1322/lfw/ec_lfw.ld @@ -9,10 +9,17 @@ /* Memory Spaces Definitions */ MEMORY { - VECTOR(r ) : ORIGIN = 0x100000, LENGTH = 24 - SRAM (xrw) : ORIGIN = 0x100018, LENGTH = 0xC00 - LENGTH(VECTOR) + VECTOR(r ) : ORIGIN = 0x100000, LENGTH = 0x18 + SRAM (xrw) : ORIGIN = 0x100018, LENGTH = 0xBE8 } +/* + * ld does not allow mathematical expressions in ORIGIN/LENGTH, so check the + * values here. + */ +ASSERT(ORIGIN(VECTOR) + LENGTH(VECTOR) == ORIGIN(SRAM), "Invalid SRAM origin.") +ASSERT(LENGTH(VECTOR) + LENGTH(SRAM) == 0xC00, "Invalid VECTOR+SRAM length.") + /* * The entry point is informative, for debuggers and simulators, * since the Cortex-M vector points to it anyway. -- cgit v1.2.1