summaryrefslogtreecommitdiff
path: root/core/riscv-rv32i/ec.lds.S
diff options
context:
space:
mode:
Diffstat (limited to 'core/riscv-rv32i/ec.lds.S')
-rw-r--r--core/riscv-rv32i/ec.lds.S13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/riscv-rv32i/ec.lds.S b/core/riscv-rv32i/ec.lds.S
index 2b88b14f24..9e7acd684b 100644
--- a/core/riscv-rv32i/ec.lds.S
+++ b/core/riscv-rv32i/ec.lds.S
@@ -348,9 +348,13 @@ SECTIONS
(__shared_mem_buf + CONFIG_SHAREDMEM_MINIMUM_SIZE);
/*
- * __flash_used is used in flash free calculations by the makefile.
+ * __flash_used and __flash_size is used in flash free calculations by
+ * the makefile. Note the difference between __flash_size and
+ * __config_flash_size. __flash_size is the flash size for the given
+ * image (RW, RO, etc.), while __config_flash_size is the *total*
+ * flash size.
* __image_size is stored in the struct image_data header and used
- * in hash calcuations.
+ * in hash calculations.
*/
#if defined(CHIP_FAMILY_IT8XXX2)
__flash_used = LOADADDR(.data) + SIZEOF(.data) + \
@@ -358,6 +362,11 @@ SECTIONS
#else
__flash_used = LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION);
#endif
+#if defined(CONFIG_FLASH_PHYSICAL)
+ __flash_size = LENGTH(FLASH);
+#else
+ __flash_size = LENGTH(IROM);
+#endif
__image_size = __flash_used;
#if defined(SECTION_IS_RW) && (CONFIG_FLASH_WRITE_SIZE > 0)