summaryrefslogtreecommitdiff
path: root/zephyr/app
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-03-19 10:20:27 -0600
committerCommit Bot <commit-bot@chromium.org>2021-03-24 20:19:48 +0000
commitd3468b111247e43ffdc1855f1c07ad802f1c3cc2 (patch)
treed781083a272121adeadd3b5f3f821f92e2a52dc0 /zephyr/app
parent5eb23205dd023a738a9cbc0ae90661a898274180 (diff)
downloadchrome-ec-d3468b111247e43ffdc1855f1c07ad802f1c3cc2.tar.gz
zephyr: Enable link time optimization (LTO)
The upstream Zephyr repo does not support LTO. Reconfigure the platform/ec source files into a cmake library so the LTO option can be enabled for all the platorm/ec sources. This reduces the Volteer flash image size by 9176 bytes. BUG=none BRANCH=none TEST=zmake testall TEST=boot zephyr-ec on Volteer, verfiy AP boots Cq-Depend: chromium:2776218 Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I8312773c8b21c498ec8116a8558b7571831159ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776217 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/app')
-rw-r--r--zephyr/app/ec/CMakeLists.txt2
-rw-r--r--zephyr/app/ec/Kconfig12
2 files changed, 13 insertions, 1 deletions
diff --git a/zephyr/app/ec/CMakeLists.txt b/zephyr/app/ec/CMakeLists.txt
index 608d2343fb..43f4ff2fe2 100644
--- a/zephyr/app/ec/CMakeLists.txt
+++ b/zephyr/app/ec/CMakeLists.txt
@@ -3,5 +3,5 @@
# found in the LICENSE file.
if(NOT DEFINED CONFIG_ZTEST)
- target_sources(app PRIVATE main.c)
+ zephyr_library_sources(main.c)
endif()
diff --git a/zephyr/app/ec/Kconfig b/zephyr/app/ec/Kconfig
index b0dab67c1b..c5ca463457 100644
--- a/zephyr/app/ec/Kconfig
+++ b/zephyr/app/ec/Kconfig
@@ -18,6 +18,18 @@ if CROS_EC
rsource "soc/Kconfig"
+config LTO
+ bool "Link Time Optimization (LTO)"
+ default y if !SOC_POSIX
+ help
+ Enable the Link Time Optimization (LTO) feature for the toolchain.
+ LTO expands the scope of optimizations to encompass the whole program,
+ reducing the image size.
+
+ At this time, LTO is only enabled for Chromium OS source files and
+ is not enabled for the Zephyr kernel or drivers due.
+ https://github.com/zephyrproject-rtos/zephyr/issues/2112
+
choice CBPRINTF_IMPLEMENTATION
default CBPRINTF_NANO