Bluetooth: Host: Remove printk dependency from settings

Some modules use snprintk to format the settings keys. Unfortunately
snprintk is tied with printk which is very large for some embedded
systems.
To be able to have settings enabled without also enabling printk
support, change creation of settings key strings to use bin2hex, strlen
and strcpy instead.
A utility function to make decimal presentation of a byte value is
added as u8_to_dec in lib/os/dec.c
Add new Kconfig setting BT_SETTINGS_USE_PRINTK

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
This commit is contained in:
Kim Sekkelund 2019-09-13 14:06:22 +02:00 committed by Carles Cufí
commit 0450263393
11 changed files with 215 additions and 29 deletions

View file

@ -160,7 +160,7 @@ config BT_HOST_CRYPTO
config BT_SETTINGS
bool "Store Bluetooth state and configuration persistently"
depends on SETTINGS && PRINTK
depends on SETTINGS
select MPU_ALLOW_FLASH_WRITE if ARM_MPU
help
When selected, the Bluetooth stack will take care of storing
@ -186,6 +186,17 @@ config BT_SETTINGS_CCC_STORE_ON_WRITE
Choosing this option is safer for battery-powered devices or devices
that expect to be reset suddenly. However, it requires additional
workqueue stack space.
config BT_SETTINGS_USE_PRINTK
bool "Use snprintk to encode Bluetooth settings key strings"
depends on SETTINGS && PRINTK
default y
help
When selected, Bluetooth settings will use snprintk to encode
key strings.
When not selected, Bluetooth settings will use a faster builtin
function to encode the key string. The drawback is that if
printk is enabled then the program memory footprint will be larger.
endif # BT_SETTINGS
config BT_WHITELIST