summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-13 17:15:49 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-30 03:28:44 +0000
commitabc2739388ef0085152cf9236f4295b739f61ebb (patch)
tree16b1c03131bbc328e66b11f4fdcae79841e9a240
parentd40d25fd2a56d2947701f93ebf637b9db50d65c0 (diff)
downloadchrome-ec-abc2739388ef0085152cf9236f4295b739f61ebb.tar.gz
fix off-by-one in flash size check
__hey_flash_used is actually a size rather than an offset, it might be equal to flash if we use every single byte. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=none TEST=make buildall with the following CLs, samus_pd uses every single byte of flash. Original-Change-Id: I98ddac73fab80c44ca2743ab2847321d71746752 Reviewed-on: https://chromium-review.googlesource.com/240539 Reviewed-by: Alec Berg <alecaberg@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 03f66537a2bdd039341b03b073c63c6554b8cc10) Reviewed-on: https://chromium-review.googlesource.com/240835 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit a33bd4f9c8fa455bfdfdd8aff47dffb7f22656f0) Signed-off-by: Todd Broch <tbroch@chromium.org> Change-Id: I69cfbb3c4bf06bc5753be9825e7086f12e9fe713 Reviewed-on: https://chromium-review.googlesource.com/244235 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
-rw-r--r--core/cortex-m/ec.lds.S2
-rw-r--r--core/cortex-m0/ec.lds.S2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index bd813a8b22..aee9671438 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -246,7 +246,7 @@ SECTIONS
* explicit ASSERT afterwards will cause the linker to abort if we use too
* much. */
__hey_flash_used = LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION);
- ASSERT(FW_SIZE(SECTION) >
+ ASSERT(FW_SIZE(SECTION) >=
(LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)),
"No room left in the flash")
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index 4a4ddd23f4..c3ba800b0e 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -234,7 +234,7 @@ SECTIONS
* explicit ASSERT afterwards will cause the linker to abort if we use too
* much. */
__hey_flash_used = LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION);
- ASSERT(FW_SIZE(SECTION) >
+ ASSERT(FW_SIZE(SECTION) >=
(LOADADDR(.data) + SIZEOF(.data) - FW_OFF(SECTION)),
"No room left in the flash")