From 88cf6cb46fd89a357568a90f364da2f80142cf12 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 11 Jun 2019 11:32:49 +0200 Subject: [PATCH] sys/auto_init/netif: Increased cc110x stack size With the increase of the message queue size from 8 to 16 in 946b06e4f0ea2faf8b63f427dab3720e48790f76, the default stack became too small. This changes the stack size to grow with the message queue size. --- sys/auto_init/netif/auto_init_cc110x.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/auto_init/netif/auto_init_cc110x.c b/sys/auto_init/netif/auto_init_cc110x.c index 1403c5f7c6..42645c6c84 100644 --- a/sys/auto_init/netif/auto_init_cc110x.c +++ b/sys/auto_init/netif/auto_init_cc110x.c @@ -21,22 +21,37 @@ #ifdef MODULE_CC110X -#include "log.h" #include "cc110x.h" #include "cc1xxx_common.h" #include "cc110x_params.h" +#include "log.h" +#include "msg.h" +#include "net/gnrc/netif/conf.h" /* <- GNRC_NETIF_MSG_QUEUE_SIZE */ #define ENABLE_DEBUG (0) #include "debug.h" +#ifndef CC110X_EXTRA_STACKSIZE +/** + * @brief Additional stack size required by the driver + * + * With increasing of GNRC_NETIF_MSG_QUEUE_SIZE the required stack size + * increases as well. A queue size of 8 messages works with default stack size, + * so we increase the stack by `sizeof(msg_t)` for each additional element + */ +#define CC110X_EXTRA_STACKSIZE ((GNRC_NETIF_MSG_QUEUE_SIZE - 8) * sizeof(msg_t)) +#endif + /** * @brief Calculate the stack size for the MAC layer thread(s) */ -#define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) +#define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + \ + CC110X_EXTRA_STACKSIZE + \ + DEBUG_EXTRA_STACKSIZE) #ifndef CC110X_MAC_PRIO /** * @brief The priority of the MAC layer thread */ -#define CC110X_MAC_PRIO (GNRC_NETIF_PRIO) +#define CC110X_MAC_PRIO (GNRC_NETIF_PRIO) #endif /**