diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-09-16 10:36:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-10-19 20:07:09 -0700 |
commit | 5e1c63f6ebc9afb847d635c36e0bec31ecdf6a52 (patch) | |
tree | 6943771d8186285428869c72252a151f62a48069 /Makefile.toolchain | |
parent | 09ad7536ce23eef7fcfb5a46318990fbe4914843 (diff) | |
download | chrome-ec-5e1c63f6ebc9afb847d635c36e0bec31ecdf6a52.tar.gz |
Support alignment for EC host command structures
The host command parameter and response buffers should be explicitly
aligned by the LPC/SPI/I2C drivers. But the host command handlers don't
know that, and the structs are all __packed, so the compiler generates
horribly inefficient ARM Cortex-M code to cope with unaligned accesses.
Add __ec_align{1,2,4} to force the param / response structs to be
aligned. Use it in a few structs now which were straightforward to
test. It should be added to more structs as space is needed, but that
would make this change unwieldy to review and test.
Add CONFIG_HOSTCMD_ALIGNED to enable the additional alignment.
Currently, this is enabled only for LM4 and samus_pd, so that EC code
can be tested without affecting other non-samus ToT development (none of
which uses LM4).
Fix the two handlers that weren't actually aligned (despite one of
them having comments to the contrary).
Also, add a CHROMIUM_EC define that can be used to determine if a file
is being compiled for an EC target. We need that so that we only force
structure alignment for EC binaries. On the AP side, buffers may not be
aligned, so we should not force alignment.
BUG=chromium:647727
BRANCH=none
TEST=Flash samus and samus_pd. Boot samus and run a bunch of ectool
commands (with and without --dev=1, so it tests both EC and PD).
System boots and all commands return expected results.
Change-Id: I4537d61a75cf087647e24281288392eb85f22eba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/387126
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r-- | Makefile.toolchain | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain index 015701b6e4..202956d4ea 100644 --- a/Makefile.toolchain +++ b/Makefile.toolchain @@ -71,6 +71,7 @@ endif CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(CFLAGS_WARN) $(CFLAGS_y) CFLAGS+= -ffunction-sections -fshort-wchar CFLAGS+= -fno-delete-null-pointer-checks -fconserve-stack +CFLAGS+= -DCHROMIUM_EC FTDIVERSION=$(shell $(PKG_CONFIG) --modversion libftdi1 2>/dev/null) ifneq ($(FTDIVERSION),) |