zephyr/subsys
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
..
app_memory subsys: app_memory: Fixed the size calculation for power of 2 MPUs 2018-09-20 11:25:53 -04:00
bluetooth Bluetooth: Controller: Use a different flag for speed optimization 2018-10-26 15:55:49 +01:00
console subsys: console: Split serial tty handling to a separate module 2018-10-03 16:40:49 +02:00
cpp
debug tracing: don't include kernel_structs.h from tracing_sysview.h 2018-10-05 10:37:01 -04:00
dfu dfu: log: rename level variable 2018-10-08 17:49:12 -04:00
disk subsys: disk access: move to new logger 2018-10-16 17:30:09 -04:00
fb subsys: add monochrome character framebuffer 2018-10-16 14:54:47 -04:00
fs shell: Fix typo 2018-10-21 17:25:14 -04:00
logging logging: fix out of bounds write in log_strdup 2018-10-24 16:41:21 +01:00
mgmt
net net: Drop IPv4 packet if source address is broadcast one 2018-10-26 15:37:21 +03:00
power subsys: power: Add an API for force suspending the devices 2018-10-17 22:02:06 -04:00
random
settings
shell shell: fix history feature 2018-10-24 14:31:25 +01:00
storage subsys: storage: flash_map: add API for check flash driver support 2018-09-27 16:24:21 +02:00
usb subsys: usb: class: hid: Allow control of USB poll interval 2018-10-25 12:54:24 +01:00
CMakeLists.txt subsys: add monochrome character framebuffer 2018-10-16 14:54:47 -04:00
Kconfig subsys: add monochrome character framebuffer 2018-10-16 14:54:47 -04:00