Fix HCI command buffer allocation failure, that can cause loss of Host Number of Completed Packets command. Fail by rejecting the HCI Host Buffer Size command if the required number of HCI command buffers are not allocated in the Controller implementation. When Controller to Host data flow control is supported in the Controller only build, ensure that BT_BUF_CMD_TX_COUNT is greater than or equal to (BT_BUF_RX_COUNT + Ncmd), where Ncmd is supported maximum Num_HCI_Command_Packets in the Controller implementation. Relates to commit81614307e9("Bluetooth: Add workaround for no command buffer available")'. Relates to commit297f4f481f("Bluetooth: Split HCI command & event buffers to two pools"). Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
120 lines
3.2 KiB
Plaintext
120 lines
3.2 KiB
Plaintext
CONFIG_BT=y
|
|
CONFIG_BT_SMP=y
|
|
CONFIG_BT_PERIPHERAL=y
|
|
CONFIG_BT_DIS=y
|
|
CONFIG_BT_DIS_PNP=n
|
|
CONFIG_BT_BAS=y
|
|
CONFIG_BT_HRS=y
|
|
CONFIG_BT_DEVICE_NAME="Zephyr Heartrate Sensor"
|
|
CONFIG_BT_DEVICE_APPEARANCE=833
|
|
|
|
# Drivers and peripherals
|
|
CONFIG_I2C=n
|
|
CONFIG_WATCHDOG=n
|
|
CONFIG_PINCTRL=n
|
|
CONFIG_SPI=n
|
|
CONFIG_GPIO=n
|
|
CONFIG_SERIAL=n
|
|
|
|
# Power management
|
|
CONFIG_PM=n
|
|
|
|
# Interrupts
|
|
CONFIG_DYNAMIC_INTERRUPTS=n
|
|
CONFIG_IRQ_OFFLOAD=n
|
|
|
|
# Memory protection
|
|
CONFIG_THREAD_STACK_INFO=n
|
|
CONFIG_THREAD_CUSTOM_DATA=n
|
|
CONFIG_FPU=n
|
|
|
|
# Boot
|
|
CONFIG_BOOT_BANNER=n
|
|
CONFIG_BOOT_DELAY=0
|
|
|
|
# Console
|
|
CONFIG_CONSOLE=n
|
|
CONFIG_UART_CONSOLE=n
|
|
CONFIG_STDOUT_CONSOLE=n
|
|
CONFIG_PRINTK=n
|
|
CONFIG_EARLY_CONSOLE=n
|
|
|
|
# Build
|
|
CONFIG_SIZE_OPTIMIZATIONS=y
|
|
|
|
# ARM
|
|
CONFIG_ARM_MPU=n
|
|
|
|
# In order to correctly tune the stack sizes for the threads the following
|
|
# Configurations can enabled to print the current use:
|
|
# CONFIG_THREAD_NAME=y
|
|
# CONFIG_THREAD_ANALYZER=y
|
|
# CONFIG_THREAD_ANALYZER_AUTO=y
|
|
# CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
|
|
# CONFIG_THREAD_ANALYZER_USE_PRINTK=y
|
|
# CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=20
|
|
# CONFIG_CONSOLE=y
|
|
# CONFIG_UART_CONSOLE=y
|
|
# CONFIG_SERIAL=y
|
|
# CONFIG_PRINTK=y
|
|
|
|
# Example output of thread analyzer
|
|
# BT RX : STACK: unused 576 usage 448 / 1024 (43 %); CPU: 0 %
|
|
# BT RX pri : STACK: unused 260 usage 188 / 448 (41 %); CPU: 0 %
|
|
# BT ECC : STACK: unused 256 usage 888 / 1144 (77 %); CPU: 1 %
|
|
# BT TX : STACK: unused 296 usage 344 / 640 (53 %); CPU: 0 %
|
|
# thread_analyzer : STACK: unused 128 usage 384 / 512 (75 %); CPU: 1 %
|
|
# sysworkq : STACK: unused 856 usage 168 / 1024 (16 %); CPU: 0 %
|
|
# logging : STACK: unused 232 usage 536 / 768 (69 %); CPU: 0 %
|
|
# idle 00 : STACK: unused 208 usage 48 / 256 (18 %); CPU: 97 %
|
|
# main : STACK: unused 576 usage 448 / 1024 (43 %); CPU: 0 %
|
|
CONFIG_BT_RX_STACK_SIZE=1024
|
|
CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y
|
|
CONFIG_BT_HCI_TX_STACK_SIZE=640
|
|
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
|
|
CONFIG_IDLE_STACK_SIZE=128
|
|
CONFIG_MAIN_STACK_SIZE=640
|
|
CONFIG_ISR_STACK_SIZE=1024
|
|
|
|
# Disable features not needed
|
|
CONFIG_TIMESLICING=n
|
|
CONFIG_COMMON_LIBC_MALLOC=n
|
|
CONFIG_LOG=n
|
|
CONFIG_ASSERT=n
|
|
|
|
# Disable Bluetooth features not needed
|
|
# CONFIG_BT_DEBUG_NONE=y
|
|
CONFIG_BT_ASSERT=n
|
|
CONFIG_BT_DATA_LEN_UPDATE=n
|
|
CONFIG_BT_PHY_UPDATE=n
|
|
CONFIG_BT_GATT_CACHING=n
|
|
CONFIG_BT_GATT_SERVICE_CHANGED=n
|
|
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n
|
|
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y
|
|
CONFIG_BT_HCI_VS=n
|
|
|
|
# Disable Bluetooth controller features not needed
|
|
CONFIG_BT_CTLR_PRIVACY=n
|
|
CONFIG_BT_CTLR_PHY_2M=n
|
|
|
|
# Reduce Bluetooth buffers
|
|
CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1
|
|
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=45
|
|
CONFIG_BT_BUF_EVT_RX_COUNT=4
|
|
|
|
CONFIG_BT_L2CAP_TX_BUF_COUNT=2
|
|
CONFIG_BT_CTLR_RX_BUFFERS=1
|
|
CONFIG_BT_BUF_ACL_TX_COUNT=3
|
|
CONFIG_BT_BUF_ACL_TX_SIZE=27
|
|
|
|
# Limit the number of key slots in PSA Crypto core to reduce
|
|
# RAM footprint
|
|
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=5
|
|
|
|
# This is required because otherwise there won't be
|
|
# __heap_start/__heap_end symbols defined in the build. This
|
|
# is due to Mbed TLS which at boot uses standard calloc/free
|
|
# functions and only after the initialization done from Zephyr
|
|
# it switches to its internal memory management functions.
|
|
CONFIG_COMMON_LIBC_MALLOC=y
|