Skip to content

Commit

Permalink
sys/auto_init/netif: Increased cc110x stack size
Browse files Browse the repository at this point in the history
With the increase of the message queue size from 8 to 16 in
946b06e, the default stack became too small.
This changes the stack size to grow with the message queue size.
  • Loading branch information
maribu committed Aug 20, 2019
1 parent 9723674 commit 88cf6cb
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions sys/auto_init/netif/auto_init_cc110x.c
Expand Up @@ -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

/**
Expand Down

0 comments on commit 88cf6cb

Please sign in to comment.