zephyr/subsys/bluetooth/controller
Sebastian Bøe 5e23278bab Bluetooth: Controller: Use a different flag for speed optimization
The bluetooth controller has been using the flag '-Ofast' to keep
within a real-time limit. There are two problems with this; firstly,
when a project should be optimized for size it is standard to use -O2,
not -Ofast.

Secondly, optimization flags have been deemed to be non-portable, so
instead of directly using "-Ofast" we should use the intent-macro
OPTIMIZE_FOR_SPEED_FLAG to ensure toolchain portability.

Testing has shown that we are still within the real-time limit when
changing from -Ofast to -O2. -Ofast is about 1us and 1% faster, but
increases the code size by 13kB (5% of the available flash on a
nRF51).

Since the slowdown is comparatively small compared to the code size
increase we have decided to use -O2 in place of -Ofast.

Other optimization combinations were also measured and their results
can be seen below:

-Ofast in BLE Controller and in #pragma in entropy driver.

        Memory region         Used Size  Region Size  %age Used
                   FLASH:      138920 B       256 KB     52.99%

        [bt] [INF] encode_control: l: 6, 6, 7; t: 75, 45, 132.

-O2 in BLE Controller and in #pragma in entropy driver.

        Memory region         Used Size  Region Size  %age Used
                   FLASH:      125840 B       256 KB     48.00%

        [bt] [INF] encode_control: l: 6, 6, 7; t: 75, 51, 133

-O3 in BLE Controller and in #pragma in entropy driver.

        Memory region         Used Size  Region Size  %age Used
                   FLASH:      138920 B       256 KB     52.99%

        [bt] [INF] encode_control: l: 6, 6, 7; t: 75, 50, 132.

No extra CFLAGS for BLE and entropy driver (pragmas removed), using
CONFIG_SIZE_OPTIMIZATIONS=y

        Memory region         Used Size  Region Size  %age Used
                   FLASH:      120124 B       256 KB     45.82%

        [bt] [ERR] isr_rx_conn: assert: '!radio_is_ready()' failed

No extra CFLAGS for BLE and entropy driver (pragmas removed), using
CONFIG_SPEED_OPTIMIZATIONS=y

        Memory region         Used Size  Region Size  %age Used
                   FLASH:      138004 B       256 KB     52.64%

        [bt] [INF] encode_control: l: 6, 6, 7; t: 61, 51, 130.

NB: RAM usage differences were insignificant.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-26 15:55:49 +01:00
..
crypto Bluetooth: Switch from SYS_LOG to logger-based logging 2018-10-19 14:50:22 +02:00
hal Bluetooth: Switch from SYS_LOG to logger-based logging 2018-10-19 14:50:22 +02:00
hci Bluetooth: Remove custom stack macros 2018-10-19 14:50:22 +02:00
include Bluetooth: controller: Fix connection cancel deadlock 2018-10-05 13:44:10 +02:00
ll_sw Bluetooth: controller: Compile conn complete due to cancel conditionally 2018-10-25 17:03:59 +01:00
ticker Bluetooth: Switch from SYS_LOG to logger-based logging 2018-10-19 14:50:22 +02:00
util coccicnelle: Ignore return of memset 2018-09-14 16:55:37 -04:00
CMakeLists.txt Bluetooth: Controller: Use a different flag for speed optimization 2018-10-26 15:55:49 +01:00
Kconfig Bluetooth: controller: Avoid retransmission of NACK-ed Tx PDU 2018-10-16 10:32:41 +02:00