mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-08 00:42:50 +00:00
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> |
||
---|---|---|
.. | ||
app_memory | ||
bluetooth | ||
console | ||
cpp | ||
debug | ||
dfu | ||
disk | ||
fb | ||
fs | ||
logging | ||
mgmt | ||
net | ||
power | ||
random | ||
settings | ||
shell | ||
storage | ||
usb | ||
CMakeLists.txt | ||
Kconfig |