summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-08-15 13:57:06 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-18 04:25:06 +0000
commitdfdbd37b6bbc296dcceda9cee121e30709833d85 (patch)
treecf211f22e630035ef1171298d29ec20825b61521 /core/cortex-m
parent001653461171f9685adfcba16b6d2e6108dfe725 (diff)
downloadchrome-ec-dfdbd37b6bbc296dcceda9cee121e30709833d85.tar.gz
cortex-m: Fix flash size calculation boards without flash
CL:2334389 broke the make debug output for the kukui_scp and flapjack_scp boards. The actual EC image was not affected. This change also cleans up the #ifdef usage to consolidate assignment of the output sections into one place. BUG=b:164696005 BRANCH=none TEST=make buildall TEST=Run "util/compare_board.sh -b cortex-m" Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: If69cb492e2aa5f1181e27be24ee66f63cc74ff62 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2359492 Reviewed-by: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/ec.lds.S50
1 files changed, 25 insertions, 25 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index ed57a29529..aa3e7f3bfc 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -110,6 +110,23 @@ MEMORY
#endif
}
+/*
+ * Convenience macros for determining the correct output memory section.
+ */
+#if !defined(CONFIG_FLASH_PHYSICAL)
+ #define EC_IMAGE_LMA_MEM_REGION IROM
+ #define EC_IMAGE_VMA_MEM_REGION IROM
+ #define DATA_LMA_MEM_REGION IROM
+#else
+ #define EC_IMAGE_LMA_MEM_REGION FLASH
+ #ifdef CONFIG_EXTERNAL_STORAGE
+ #define EC_IMAGE_VMA_MEM_REGION CDRAM
+ #else
+ #define EC_IMAGE_VMA_MEM_REGION FLASH
+ #endif
+ #define DATA_LMA_MEM_REGION FLASH
+#endif
+
SECTIONS
{
#if defined(SECTION_IS_RO) && defined(NPCX_RO_HEADER)
@@ -158,14 +175,9 @@ SECTIONS
KEEP(*(.lowpower_ram2))
. = ALIGN(4);
__flash_lplfw_end = .;
- } > CDRAM AT > FLASH
-#else
-# if !defined(CONFIG_FLASH_PHYSICAL)
- } > IROM
-# else
- } > FLASH
-# endif /* !CONFIG_FLASH_PHYSICAL */
-#endif
+#endif /* CONFIG_EXTERNAL_STORAGE */
+ } > EC_IMAGE_VMA_MEM_REGION AT > EC_IMAGE_LMA_MEM_REGION
+
. = ALIGN(4);
.rodata : {
/* Symbols defined here are declared in link_defs.h */
@@ -330,16 +342,7 @@ SECTIONS
#endif
. = 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
+ } > EC_IMAGE_VMA_MEM_REGION AT > EC_IMAGE_LMA_MEM_REGION
__data_lma_start = .;
@@ -467,7 +470,9 @@ SECTIONS
* __image_size is stored in the struct image_data header and used
* in hash calcuations.
*/
- __flash_used = LOADADDR(.data) + SIZEOF(.data) - ORIGIN(FLASH);
+ __flash_used = LOADADDR(.data) + SIZEOF(.data) -
+ ORIGIN(EC_IMAGE_LMA_MEM_REGION);
+ __image_size = __flash_used;
#ifdef CONFIG_FLASH
/*
@@ -485,7 +490,7 @@ SECTIONS
* apparently because we're sending it into IRAM, not FLASH.
* Verify that all sections linked into the FLASH region will fit.
*/
- ASSERT((LENGTH(FLASH)
+ ASSERT((LENGTH(EC_IMAGE_LMA_MEM_REGION)
#if defined(CONFIG_RWSIG) && defined(SECTION_IS_RO)
- CONFIG_RO_PUBKEY_SIZE
#endif
@@ -555,11 +560,6 @@ SECTIONS
* FLASH region and the bytes used in the .init_rom section.
*/
__image_size = LENGTH(FLASH) + SIZEOF(.init_rom);
-#else
- /*
- * Typical build: __image_size is the same as __flash_used.
- */
- __image_size = __flash_used;
#endif /* CONFIG_CHIP_INIT_ROM_REGION */
#ifdef CONFIG_CHIP_MEMORY_REGIONS