Bluetooth: Controller: Measure and use correct stack size

Use stack_analyse in the recv fiber to print actual stack
usage, use this as default in Kconfig option, and declare a
rx fiber stack of Kconfig supplied stack size.

Change-id: Id97ad2de4f7be3069f93271d60544f760abbf575
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
This commit is contained in:
Vinayak Chettimada 2016-09-01 21:34:56 +02:00 committed by Johan Hedberg
commit 7a0561a60f
2 changed files with 16 additions and 1 deletions

View file

@ -27,4 +27,13 @@ config BLUETOOTH_CONTROLLER_TX_BUFFERS
Set the number of Tx PDUs to be queued for transmission
in the controller.
config BLUETOOTH_CONTROLLER_RX_STACK_SIZE
int "Size of the receiving fiber stack"
default 256
range 256 65536
help
Size of the receiving fiber stack. This is the context from
which all radio messages are encoded into HCI events or data
before passing it to Bluetooth receiving fiber.
endif # BLUETOOTH_CONTROLLER

View file

@ -25,6 +25,7 @@
#include <init.h>
#include <uart.h>
#include <misc/util.h>
#include <misc/stack.h>
#include <misc/byteorder.h>
#include <string.h>
@ -63,7 +64,8 @@ static uint8_t ALIGNED(4) _ticker_user_ops[RADIO_TICKER_USER_OPS]
static uint8_t ALIGNED(4) _radio[LL_MEM_TOTAL];
static struct nano_sem nano_sem_native_recv;
static BT_STACK_NOINIT(native_recv_fiber_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE);
static BT_STACK_NOINIT(native_recv_fiber_stack,
CONFIG_BLUETOOTH_CONTROLLER_RX_STACK_SIZE);
void radio_active_callback(uint8_t active)
{
@ -256,6 +258,10 @@ static void native_recv_fiber(int unused0, int unused1)
nano_fiber_sem_take(&nano_sem_native_recv,
TICKS_UNLIMITED);
}
stack_analyze("native recv fiber stack",
native_recv_fiber_stack,
sizeof(native_recv_fiber_stack));
}
}