misc: use K_THREAD_STACK_DEFINE macros

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-06-02 14:10:09 -07:00 committed by Anas Nashif
parent e87eacacfa
commit 567c6c7683
12 changed files with 34 additions and 30 deletions

View file

@ -41,7 +41,7 @@ QUARK_SE_IPM_DEFINE(quark_se_ipm4, 4, QUARK_SE_IPM_INBOUND);
#define QUARK_SE_IPM_CONSOLE_LINE_BUF_SIZE 80
static u32_t ipm_console_ring_buf_data[CONFIG_QUARK_SE_IPM_CONSOLE_RING_BUF_SIZE32];
static char __stack ipm_console_thread_stack[CONFIG_IPM_CONSOLE_STACK_SIZE];
static K_STACK_DECLARE(ipm_console_thread_stack, CONFIG_IPM_CONSOLE_STACK_SIZE);
static char ipm_console_line_buf[QUARK_SE_IPM_CONSOLE_LINE_BUF_SIZE];
static struct ipm_console_receiver_config_info quark_se_ipm_receiver_config = {

View file

@ -115,7 +115,7 @@ struct net_stack_info {
NET_STACK_INFO_ADDR(_pretty_name, _name, _orig, _size, _name, 0)
#define NET_STACK_DEFINE(pretty_name, name, orig, size) \
static char __noinit __stack name[size]; \
K_THREAD_STACK_DEFINE(name, size); \
NET_STACK_INFO(pretty_name, name, orig, size)
#else /* CONFIG_NET_SHELL */
@ -124,7 +124,7 @@ struct net_stack_info {
#define NET_STACK_INFO_ADDR(...)
#define NET_STACK_DEFINE(pretty_name, name, orig, size) \
static char __noinit __stack name[size]
K_THREAD_STACK_DEFINE(name, size)
#endif /* CONFIG_NET_SHELL */

View file

@ -95,9 +95,9 @@ static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {};
}
#define BT_STACK(name, size) \
char __stack name[(size) + BT_STACK_DEBUG_EXTRA]
K_THREAD_STACK_MEMBER(name, (size) + BT_STACK_DEBUG_EXTRA)
#define BT_STACK_NOINIT(name, size) \
char __noinit __stack name[(size) + BT_STACK_DEBUG_EXTRA]
K_THREAD_STACK_DEFINE(name, (size) + BT_STACK_DEBUG_EXTRA)
/* This helper is only available when BLUETOOTH_DEBUG is enabled */
const char *bt_hex(const void *buf, size_t len);

View file

@ -99,9 +99,8 @@ static void prio_recv_thread(void *p1, void *p2, void *p3)
#if defined(CONFIG_INIT_STACKS)
if (k_uptime_get_32() - prio_ts > K_SECONDS(5)) {
stack_analyze("prio recv thread stack",
prio_recv_thread_stack,
sizeof(prio_recv_thread_stack));
STACK_ANALYZE("prio recv thread stack",
prio_recv_thread_stack);
prio_ts = k_uptime_get_32();
}
#endif
@ -327,8 +326,7 @@ static void recv_thread(void *p1, void *p2, void *p3)
#if defined(CONFIG_INIT_STACKS)
if (k_uptime_get_32() - rx_ts > K_SECONDS(5)) {
stack_analyze("recv thread stack", recv_thread_stack,
sizeof(recv_thread_stack));
STACK_ANALYZE("recv thread stack", recv_thread_stack);
rx_ts = k_uptime_get_32();
}
#endif
@ -403,11 +401,12 @@ static int hci_driver_open(void)
#endif
k_thread_create(&prio_recv_thread_data, prio_recv_thread_stack,
sizeof(prio_recv_thread_stack), prio_recv_thread,
K_THREAD_STACK_SIZEOF(prio_recv_thread_stack),
prio_recv_thread,
NULL, NULL, NULL, K_PRIO_COOP(6), 0, K_NO_WAIT);
k_thread_create(&recv_thread_data, recv_thread_stack,
sizeof(recv_thread_stack), recv_thread,
K_THREAD_STACK_SIZEOF(recv_thread_stack), recv_thread,
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
BT_DBG("Success.");

View file

@ -582,10 +582,9 @@ static void hci_disconn_complete(struct net_buf *buf)
/* Check stacks usage (no-ops if not enabled) */
k_call_stacks_analyze();
#if !defined(CONFIG_BLUETOOTH_RECV_IS_RX_THREAD)
stack_analyze("rx stack", rx_thread_stack, sizeof(rx_thread_stack));
STACK_ANALYZE("rx stack", rx_thread_stack);
#endif
stack_analyze("tx stack", tx_thread_stack,
sizeof(tx_thread_stack));
STACK_ANALYZE("tx stack", tx_thread_stack);
bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
conn->handle = 0;
@ -4065,13 +4064,14 @@ int bt_enable(bt_ready_cb_t cb)
/* TX thread */
k_thread_create(&tx_thread_data, tx_thread_stack,
sizeof(tx_thread_stack), hci_tx_thread, NULL, NULL,
K_THREAD_STACK_SIZEOF(tx_thread_stack),
hci_tx_thread, NULL, NULL,
NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
#if !defined(CONFIG_BLUETOOTH_RECV_IS_RX_THREAD)
/* RX thread */
k_thread_create(&rx_thread_data, rx_thread_stack,
sizeof(rx_thread_stack),
K_THREAD_STACK_SIZEOF(rx_thread_stack),
(k_thread_entry_t)hci_rx_thread, NULL, NULL, NULL,
K_PRIO_COOP(7), 0, K_NO_WAIT);
#endif

View file

@ -214,8 +214,7 @@ static void ecc_thread(void *p1, void *p2, void *p3)
__ASSERT(0, "Unhandled ECC command");
}
stack_analyze("ecc stack", ecc_thread_stack,
sizeof(ecc_thread_stack));
STACK_ANALYZE("ecc stack", ecc_thread_stack);
}
}
@ -310,6 +309,6 @@ int bt_hci_ecc_send(struct net_buf *buf)
void bt_hci_ecc_init(void)
{
k_thread_create(&ecc_thread_data, ecc_thread_stack,
sizeof(ecc_thread_stack), ecc_thread, NULL, NULL, NULL,
K_PRIO_PREEMPT(10), 0, K_NO_WAIT);
K_THREAD_STACK_SIZEOF(ecc_thread_stack), ecc_thread,
NULL, NULL, NULL, K_PRIO_PREEMPT(10), 0, K_NO_WAIT);
}

View file

@ -242,7 +242,7 @@ static void rfcomm_dlc_destroy(struct bt_rfcomm_dlc *dlc)
dlc->state = BT_RFCOMM_STATE_IDLE;
dlc->session = NULL;
stack_analyze("dlc stack", dlc->stack, sizeof(dlc->stack));
STACK_ANALYZE("dlc stack", dlc->stack);
if (dlc->ops && dlc->ops->disconnected) {
dlc->ops->disconnected(dlc);
@ -751,7 +751,8 @@ static void rfcomm_dlc_connected(struct bt_rfcomm_dlc *dlc)
k_delayed_work_cancel(&dlc->rtx_work);
k_fifo_init(&dlc->tx_queue);
k_thread_create(&dlc->tx_thread, dlc->stack, sizeof(dlc->stack),
k_thread_create(&dlc->tx_thread, dlc->stack,
K_THREAD_STACK_SIZEOF(dlc->stack),
rfcomm_dlc_tx_thread, dlc, NULL, NULL, K_PRIO_COOP(7),
0, K_NO_WAIT);

View file

@ -142,7 +142,8 @@ static void net_rx_thread(void)
{
struct net_pkt *pkt;
NET_DBG("Starting RX thread (stack %zu bytes)", sizeof(rx_stack));
NET_DBG("Starting RX thread (stack %zu bytes)",
K_THREAD_STACK_SIZEOF(rx_stack));
/* Starting TX side. The ordering is important here and the TX
* can only be started when RX side is ready to receive packets.
@ -164,7 +165,8 @@ static void net_rx_thread(void)
pkt = k_fifo_get(&rx_queue, K_FOREVER);
net_analyze_stack("RX thread", rx_stack, sizeof(rx_stack));
net_analyze_stack("RX thread", rx_stack,
K_THREAD_STACK_SIZEOF(rx_stack));
#if defined(CONFIG_NET_STATISTICS) || defined(CONFIG_NET_DEBUG_CORE)
pkt_len = net_pkt_get_len(pkt);
@ -186,7 +188,8 @@ static void init_rx_queue(void)
{
k_fifo_init(&rx_queue);
rx_tid = k_thread_create(&rx_thread_data, rx_stack, sizeof(rx_stack),
rx_tid = k_thread_create(&rx_thread_data, rx_stack,
K_THREAD_STACK_SIZEOF(rx_stack),
(k_thread_entry_t)net_rx_thread,
NULL, NULL, NULL, K_PRIO_COOP(8),
K_ESSENTIAL, K_NO_WAIT);

View file

@ -1690,7 +1690,8 @@ void net_if_init(struct k_sem *startup_sync)
return;
}
k_thread_create(&tx_thread_data, tx_stack, sizeof(tx_stack),
k_thread_create(&tx_thread_data, tx_stack,
K_THREAD_STACK_SIZEOF(tx_stack),
(k_thread_entry_t)net_if_tx_thread,
startup_sync, NULL, NULL, K_PRIO_COOP(7),
K_ESSENTIAL, K_NO_WAIT);

View file

@ -298,7 +298,8 @@ void net_mgmt_event_init(void)
CONFIG_NET_MGMT_EVENT_QUEUE_SIZE *
sizeof(struct mgmt_event_entry));
k_thread_create(&mgmt_thread_data, mgmt_stack, sizeof(mgmt_stack),
k_thread_create(&mgmt_thread_data, mgmt_stack,
K_THREAD_STACK_SIZEOF(mgmt_stack),
(k_thread_entry_t)mgmt_thread, NULL, NULL, NULL,
K_PRIO_COOP(CONFIG_NET_MGMT_EVENT_THREAD_PRIO), 0, 0);

View file

@ -44,7 +44,7 @@ static char default_module_prompt[PROMPT_MAX_LEN];
static int default_module = -1;
#define STACKSIZE CONFIG_CONSOLE_SHELL_STACKSIZE
static char __noinit __stack stack[STACKSIZE];
static K_THREAD_STACK_DEFINE(stack, STACKSIZE);
static struct k_thread shell_thread;
#define MAX_CMD_QUEUED CONFIG_CONSOLE_SHELL_MAX_CMD_QUEUED

View file

@ -57,7 +57,7 @@
#define DISK_THREAD_PRIO -5
static volatile int thread_op;
static char __noinit __stack mass_thread_stack[DISK_THREAD_STACK_SZ];
static K_THREAD_STACK_DEFINE(mass_thread_stack, DISK_THREAD_STACK_SZ);
static struct k_thread mass_thread_data;
static struct k_sem disk_wait_sem;
static volatile u32_t defered_wr_sz;