diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index 29eb61055fc..fab419e4dc4 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -38,7 +38,7 @@ #define H4_SCO 0x03 #define H4_EVT 0x04 -static BT_STACK_NOINIT(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE); +static K_THREAD_STACK_DEFINE(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE); static struct k_thread rx_thread_data; static struct { diff --git a/drivers/bluetooth/hci/h5.c b/drivers/bluetooth/hci/h5.c index 2ed6200f99a..62061ebdefb 100644 --- a/drivers/bluetooth/hci/h5.c +++ b/drivers/bluetooth/hci/h5.c @@ -30,8 +30,8 @@ #include "../util.h" -static BT_STACK_NOINIT(tx_stack, 256); -static BT_STACK_NOINIT(rx_stack, 256); +static K_THREAD_STACK_DEFINE(tx_stack, 256); +static K_THREAD_STACK_DEFINE(rx_stack, 256); static struct k_thread tx_thread_data; static struct k_thread rx_thread_data; diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index c8dd8744dd4..97bbe49b6db 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -72,7 +72,7 @@ static K_SEM_DEFINE(sem_initialised, 0, 1); static K_SEM_DEFINE(sem_request, 0, 1); static K_SEM_DEFINE(sem_busy, 1, 1); -static BT_STACK_NOINIT(rx_stack, 448); +static K_THREAD_STACK_DEFINE(rx_stack, 448); static struct k_thread rx_thread_data; #if defined(CONFIG_BT_DEBUG_HCI_DRIVER) diff --git a/drivers/bluetooth/hci/userchan.c b/drivers/bluetooth/hci/userchan.c index d6e1cdc4d21..8b8ac15cd3d 100644 --- a/drivers/bluetooth/hci/userchan.c +++ b/drivers/bluetooth/hci/userchan.c @@ -48,8 +48,8 @@ struct sockaddr_hci { #define H4_SCO 0x03 #define H4_EVT 0x04 -static BT_STACK_NOINIT(rx_thread_stack, - CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE); +static K_THREAD_STACK_DEFINE(rx_thread_stack, + CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE); static struct k_thread rx_thread_data; static int uc_fd = -1; diff --git a/include/bluetooth/rfcomm.h b/include/bluetooth/rfcomm.h index 36417c94bad..7daf7cd86dc 100644 --- a/include/bluetooth/rfcomm.h +++ b/include/bluetooth/rfcomm.h @@ -96,7 +96,7 @@ struct bt_rfcomm_dlc { /* Stack & kernel data for TX thread */ struct k_thread tx_thread; - BT_STACK(stack, 256); + K_THREAD_STACK_MEMBER(stack, 256); }; struct bt_rfcomm_server { diff --git a/samples/bluetooth/hci_spi/src/main.c b/samples/bluetooth/hci_spi/src/main.c index 36992c3cf0e..2babfe6584f 100644 --- a/samples/bluetooth/hci_spi/src/main.c +++ b/samples/bluetooth/hci_spi/src/main.c @@ -99,7 +99,7 @@ static struct spi_config spi_cfg = { .operation = SPI_WORD_SET(8), }; static struct device *gpio_dev; -static BT_STACK_NOINIT(bt_tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE); +static K_THREAD_STACK_DEFINE(bt_tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE); static struct k_thread bt_tx_thread_data; static K_SEM_DEFINE(sem_spi_rx, 0, 1); diff --git a/samples/bluetooth/hci_uart/src/main.c b/samples/bluetooth/hci_uart/src/main.c index d30051f3c03..bce01b0d863 100644 --- a/samples/bluetooth/hci_uart/src/main.c +++ b/samples/bluetooth/hci_uart/src/main.c @@ -31,7 +31,7 @@ #include "common/log.h" static struct device *hci_uart_dev; -static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE); +static K_THREAD_STACK_DEFINE(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE); static struct k_thread tx_thread_data; /* HCI command buffers */ diff --git a/subsys/bluetooth/common/log.h b/subsys/bluetooth/common/log.h index f3b045fd215..e72e92e77a0 100644 --- a/subsys/bluetooth/common/log.h +++ b/subsys/bluetooth/common/log.h @@ -49,9 +49,6 @@ __printf_like(2, 3) void bt_log(int prio, const char *fmt, ...); __func__, ##__VA_ARGS__) #define BT_INFO(fmt, ...) bt_log(BT_LOG_INFO, fmt, ##__VA_ARGS__) -/* Enabling debug increases stack size requirement */ -#define BT_STACK_DEBUG_EXTRA 300 - #elif defined(CONFIG_BT_DEBUG_LOG) #if BT_DBG_ENABLED @@ -76,9 +73,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define BT_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__) -/* Enabling debug increases stack size requirement considerably */ -#define BT_STACK_DEBUG_EXTRA 300 - #else static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {}; @@ -91,8 +85,6 @@ static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {}; #define BT_WARN BT_DBG #define BT_INFO BT_DBG -#define BT_STACK_DEBUG_EXTRA 0 - #endif #define BT_ASSERT(cond) if (!(cond)) { \ @@ -100,11 +92,6 @@ static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {}; k_oops(); \ } -#define BT_STACK(name, size) \ - K_THREAD_STACK_MEMBER(name, (size) + BT_STACK_DEBUG_EXTRA) -#define BT_STACK_NOINIT(name, size) \ - K_THREAD_STACK_DEFINE(name, (size) + BT_STACK_DEBUG_EXTRA) - /* This helper is only available when BT_DEBUG is enabled */ const char *bt_hex(const void *buf, size_t len); diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index f0ba73cb8fd..2090cafbfbb 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -49,10 +49,10 @@ static K_SEM_DEFINE(sem_prio_recv, 0, UINT_MAX); static K_FIFO_DEFINE(recv_fifo); struct k_thread prio_recv_thread_data; -static BT_STACK_NOINIT(prio_recv_thread_stack, - CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE); +static K_THREAD_STACK_DEFINE(prio_recv_thread_stack, + CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE); struct k_thread recv_thread_data; -static BT_STACK_NOINIT(recv_thread_stack, CONFIG_BT_RX_STACK_SIZE); +static K_THREAD_STACK_DEFINE(recv_thread_stack, CONFIG_BT_RX_STACK_SIZE); #if defined(CONFIG_INIT_STACKS) static u32_t prio_ts; diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 580e01071cd..216460ebfe9 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -55,10 +55,10 @@ /* Stacks for the threads */ #if !defined(CONFIG_BT_RECV_IS_RX_THREAD) static struct k_thread rx_thread_data; -static BT_STACK_NOINIT(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE); +static K_THREAD_STACK_DEFINE(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE); #endif static struct k_thread tx_thread_data; -static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE); +static K_THREAD_STACK_DEFINE(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE); static void init_work(struct k_work *work); diff --git a/subsys/bluetooth/host/hci_ecc.c b/subsys/bluetooth/host/hci_ecc.c index 82a1aa52b69..3db4ce7d2e7 100644 --- a/subsys/bluetooth/host/hci_ecc.c +++ b/subsys/bluetooth/host/hci_ecc.c @@ -36,7 +36,7 @@ #endif static struct k_thread ecc_thread_data; -static BT_STACK_NOINIT(ecc_thread_stack, 1024); +static K_THREAD_STACK_DEFINE(ecc_thread_stack, 1024); /* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */ static const u32_t debug_private_key[8] = { diff --git a/subsys/bluetooth/host/mesh/adv.c b/subsys/bluetooth/host/mesh/adv.c index 2d01ee2f827..c7f89f77d16 100644 --- a/subsys/bluetooth/host/mesh/adv.c +++ b/subsys/bluetooth/host/mesh/adv.c @@ -56,7 +56,7 @@ static K_FIFO_DEFINE(adv_queue); static struct k_thread adv_thread_data; -static BT_STACK_NOINIT(adv_thread_stack, ADV_STACK_SIZE); +static K_THREAD_STACK_DEFINE(adv_thread_stack, ADV_STACK_SIZE); static const u8_t adv_type[] = { [BT_MESH_ADV_PROV] = BT_DATA_MESH_PROV,