From cc6662135d38f1544d655cf1d4d0f1f3e3d059b7 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 12 Jul 2017 17:07:27 +0800 Subject: hammer: Enable Link-Time-Optimization CONFIG_LTO We need to add __keep to the USB descriptors, otherwise they get thrown away. Also, for some reason the optimized RWSIG task uses a little bit more stack space, so account for that: 1 RWSIG 00000000 0.264350 1096/2048 BRANCH=none BUG=b:63610290 TEST=make BOARD=hammer -j make newsizes build/hammer/RO/ec.RO.flat shrank by 2052 bytes: (37336 to 35284) build/hammer/RW/ec.RW.flat shrank by 3172 bytes: (50508 to 47336) Flash hammer, touchpad, keyboard, update all still work fine. Change-Id: I39ffd320dae883596ce481efc4adec6e3c23000b Reviewed-on: https://chromium-review.googlesource.com/567909 Commit-Ready: Nicolas Boichat Tested-by: Nicolas Boichat Reviewed-by: Randall Spangler --- board/hammer/board.h | 1 + board/hammer/ec.tasklist | 2 +- include/usb_descriptor.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/board/hammer/board.h b/board/hammer/board.h index 0e20d9f8f2..3aabd26f7a 100644 --- a/board/hammer/board.h +++ b/board/hammer/board.h @@ -73,6 +73,7 @@ /* Optional features */ #define CONFIG_LOW_POWER_IDLE +#define CONFIG_LTO #define CONFIG_FORCE_CONSOLE_RESUME #define CONFIG_STM_HWTIMER32 #define CONFIG_HW_CRC diff --git a/board/hammer/ec.tasklist b/board/hammer/ec.tasklist index 06ff3e0c1d..0cbc39dbf6 100644 --- a/board/hammer/ec.tasklist +++ b/board/hammer/ec.tasklist @@ -17,7 +17,7 @@ * 's' is the stack size in bytes; must be a multiple of 8 */ #define CONFIG_TASK_LIST \ - TASK_ALWAYS_RO(RWSIG, rwsig_task, NULL, 1024) \ + TASK_ALWAYS_RO(RWSIG, rwsig_task, NULL, 1280) \ TASK_ALWAYS (HOOKS, hook_task, NULL, 2048) \ TASK_ALWAYS_RW(TOUCHPAD, elan_tp_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS (CONSOLE, console_task, NULL, 1024) \ diff --git a/include/usb_descriptor.h b/include/usb_descriptor.h index c6e877aac6..33fde009d2 100644 --- a/include/usb_descriptor.h +++ b/include/usb_descriptor.h @@ -276,7 +276,7 @@ extern struct usb_string_desc *usb_serialno_desc; /* Use these macros for declaring descriptors, to order them properly */ #define USB_CONF_DESC_VAR(name, varname) varname \ - __attribute__((section(".rodata.usb_desc_" STRINGIFY(name)))) + __keep __attribute__((section(".rodata.usb_desc_" STRINGIFY(name)))) #define USB_CONF_DESC(name) USB_CONF_DESC_VAR(name, CONCAT2(usb_desc_, name)) #define USB_IFACE_DESC(num) USB_CONF_DESC(CONCAT3(iface, num, _0iface)) #define USB_CUSTOM_DESC_VAR(i, name, varname) \ -- cgit v1.2.1