summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-09-23 21:04:08 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-01 23:32:55 +0000
commit82393ec1c3c8a9d3e98cfccb52622d7af577427d (patch)
tree33211a7d68e31b42aa19f5650ceade13dacf7c9a /core/cortex-m
parent77d1122fd763f2d25662d45f276e9125adb658f7 (diff)
downloadchrome-ec-82393ec1c3c8a9d3e98cfccb52622d7af577427d.tar.gz
core: Add assert to check alignment
Assert that the RW image size padding adding results in correct alignment. This assertion will make it easier to verify future clang changes. BRANCH=none BUG=b:172020503, b:188117811 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibdc6feaf31cf271f67594ae1e519272fd9a88cd4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3179317 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/ec.lds.S5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 7b08be81a6..fa35684e31 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -512,6 +512,11 @@ SECTIONS
__image_size = __flash_used + SIZEOF(.rw_image_size_alignment);
#endif
+#if defined(SECTION_IS_RW) && (CONFIG_FLASH_WRITE_SIZE > 0)
+ /* Alignment is needed by flash_command_write() for RW update. */
+ ASSERT(__image_size % CONFIG_FLASH_WRITE_SIZE == 0,
+ "Error: RW image is not aligned to CONFIG_FLASH_WRITE_SIZE")
+#endif
#endif /* CONFIG_CHIP_INIT_ROM_REGION */
#ifdef CONFIG_FLASH_CROS