summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-03-14 18:28:55 +0000
committerCommit Bot <commit-bot@chromium.org>2022-03-16 18:03:22 +0000
commitf670792c75b531959010669b1deb2aeb987c974c (patch)
treec9d64d4f3fe7152c837efdd3966afd86ef9dc7a3
parenta18b111e3cb010e168abd4408c6c5b884dbc0b3e (diff)
downloadchrome-ec-f670792c75b531959010669b1deb2aeb987c974c.tar.gz
zephyr: CMakeLists: set -mno-unaligned-access
GCC can generate unaligned access instructions by default, for example: *data = buf[1] | (buf[2] << 8) | (buf[3] << 16) | (buf[4] << 24); 0x10084ac0 <+84>: itte eq 0x10084ac2 <+86>: ldreq.w r3, [sp, #17] <-- this one 0x10084ac6 <+90>: streq r3, [r7, #0] Set -mno-unaligned-access to enforce byte access on all structures. BRANCH=none BUG=b:223234903 TEST=checked the disassembled code, ran with unaligned access trap Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I8b559806b1fe9044c7401f4f8d4126a71657c308 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3521786 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 964047201f..cae062a13e 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -63,6 +63,9 @@ if(DEFINED CONFIG_PLATFORM_EC)
endif()
endif()
+# Set extra compiler flags.
+zephyr_cc_option(-mno-unaligned-access)
+
# The EC application is split into two libraries:
# app: contains all the legacy code
# ec_shim: contains all the code under platform/ec/shim