Skip to content

Commit 1b7fe79

Browse files
cvinayakdleach02
authored andcommitted
Bluetooth: Controller: Support Link Time Optimizations (LTO)
Support for using Link Time Optimization (LTO) when building application with open source Bluetooth Low Energy Controller. This reduces code space usage. Current Memory Usage at the time of this PR (hci_ipc): BT_CTLR_OPTIMIZE_FOR_SPEED: Memory region Used Size Region Size %age Used FLASH: 260112 B 256 KB 99.22% RAM: 60136 B 64 KB 91.76% SRAM1: 0 B 64 KB 0.00% IDT_LIST: 0 B 32 KB 0.00% BT_CTLR_OPTIMIZE_FOR_SIZE: Memory region Used Size Region Size %age Used FLASH: 232292 B 256 KB 88.61% RAM: 60128 B 64 KB 91.75% SRAM1: 0 B 64 KB 0.00% IDT_LIST: 0 B 32 KB 0.00% BT_CTLR_OPTIMIZE_FOR_APP_DEFAULT: Memory region Used Size Region Size %age Used FLASH: 232292 B 256 KB 88.61% RAM: 60128 B 64 KB 91.75% SRAM1: 0 B 64 KB 0.00% IDT_LIST: 0 B 32 KB 0.00% BT_CTLR_LTO: Memory region Used Size Region Size %age Used FLASH: 221484 B 256 KB 84.49% RAM: 60120 B 64 KB 91.74% SRAM1: 0 B 64 KB 0.00% IDT_LIST: 0 B 32 KB 0.00% Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
1 parent 31c048f commit 1b7fe79

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

subsys/bluetooth/controller/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ add_subdirectory_ifdef(
212212
ll_sw/openisa
213213
)
214214

215+
zephyr_library_compile_options_ifdef(
216+
CONFIG_BT_CTLR_OPTIMIZE_FOR_SIZE
217+
${OPTIMIZE_FOR_SIZE_FLAG}
218+
)
219+
215220
zephyr_library_compile_options_ifdef(
216221
CONFIG_BT_CTLR_OPTIMIZE_FOR_SPEED
217222
${OPTIMIZE_FOR_SPEED_FLAG}

subsys/bluetooth/controller/Kconfig.ll_sw_split

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,34 @@ config BT_CTLR_DYNAMIC_INTERRUPTS
598598
permit use of SoC's peripheral for custom use when Bluetooth is not
599599
enabled.
600600

601+
choice
602+
prompt "Optimization options"
603+
depends on !LTO
604+
default BT_CTLR_OPTIMIZE_FOR_SPEED
605+
606+
config BT_CTLR_OPTIMIZE_FOR_APP_DEFAULT
607+
bool "Optimize for application defaults"
608+
help
609+
Optimize compilation of Controller for application's default.
610+
611+
config BT_CTLR_OPTIMIZE_FOR_SIZE
612+
bool "Optimize for space"
613+
help
614+
Optimize compilation of Controller for code size.
615+
616+
This is the Zephyr project default, but is overridden to use optimize
617+
for speed when compiling the Controller to reduce application's ISR
618+
and thread latencies.
619+
601620
config BT_CTLR_OPTIMIZE_FOR_SPEED
602-
prompt "Optimize for Speed"
603-
bool
604-
default y
621+
bool "Optimize for Speed"
605622
help
606-
Optimize compilation of controller for execution speed.
623+
Optimize compilation of Controller for execution speed. As the
624+
Controller's Upper Link Layer and Lower Link Layer execute in ISRs,
625+
use of speed optimizations reduces application's ISR and thread
626+
latencies.
627+
628+
endchoice
607629

608630
config BT_CTLR_XTAL_ADVANCED
609631
bool "Advanced event preparation"

0 commit comments

Comments
 (0)