From 426170b06439badf41818a58b37117aac26806a9 Mon Sep 17 00:00:00 2001
From: Lucas Jenss <lucas@x3ro.de>
Date: Tue, 28 Apr 2015 20:02:05 +0200
Subject: [PATCH] Improve naming of thread stacksize/priority constants

As discussed in #2725, this commit renames a number of stacksize constants to
better convey their intended usage. In addition, constants for thread priority
are given a `THREAD_` prefix. Changes are:

* KERNEL_CONF_STACKSIZE_PRINTF renamed to THREAD_EXTRA_STACKSIZE_PRINTF
* KERNEL_CONF_STACKSIZE_DEFAULT renamed to THREAD_STACKSIZE_DEFAULT
* KERNEL_CONF_STACKSIZE_IDLE renamed to THREAD_STACKSIZE_IDLE
* KERNEL_CONF_STACKSIZE_MAIN renamed to THREAD_STACKSIZE_MAIN
* Move thread stacksizes from kernel.h to thread.h, since the prefix changed
* PRIORITY_MIN renamed to THREAD_PRIORITY_MIN
* PRIORITY_IDLE renamed to THREAD_PRIORITY_IDLE
* PRIORITY_MAIN renamed to THREAD_PRIORITY_MAIN
* Move thread priorities from kernel.h to thread.h since the prefix has changed
* MINIMUM_STACK_SIZE renamed to THREAD_STACKSIZE_MINIMUM for consistency
---
 .../auto_init_ng_netif/netif_board.c          |  63 ++++++++++++
 boards/qemu-i386/include/cpu-conf.h           |  11 +--
 .../auto_init_ng_netif/netif_board.c          |   4 +-
 core/include/debug.h                          |   2 +-
 core/include/kernel.h                         |  50 ----------
 core/include/thread.h                         |  57 ++++++++++-
 core/kernel_init.c                            |  12 +--
 core/msg.c                                    |   4 +-
 cpu/atmega2560/include/cpu-conf.h             |   8 +-
 cpu/cc2538/include/cpu-conf.h                 |   8 +-
 cpu/k60/include/cpu-conf.h                    |   8 +-
 cpu/kw2x/include/cpu-conf.h                   |   8 +-
 cpu/lpc1768/include/cpu-conf.h                |   8 +-
 cpu/lpc2387/include/cpu-conf.h                |  10 +-
 cpu/mc1322x/include/cpu-conf.h                |  10 +-
 cpu/msp430-common/include/cpu-conf.h          |  10 +-
 cpu/native/include/cpu-conf.h                 |  22 ++---
 cpu/nrf51822/include/cpu-conf.h               |   8 +-
 cpu/sam3x8e/include/cpu-conf.h                |   8 +-
 cpu/samd21/include/cpu-conf.h                 |   8 +-
 cpu/stm32f0/include/cpu-conf.h                |   8 +-
 cpu/stm32f1/include/cpu-conf.h                |   8 +-
 cpu/stm32f3/include/cpu-conf.h                |   8 +-
 cpu/stm32f4/include/cpu-conf.h                |   8 +-
 cpu/stm32l1/include/cpu-conf.h                |   8 +-
 cpu/x86/x86_hwtimer.c                         |   2 +-
 doc/doxygen/src/mainpage.txt                  |  20 ++--
 drivers/cc110x_legacy_csma/cc1100_phy.c       |   4 +-
 examples/ccn-lite-client/main.c               |   8 +-
 examples/ccn-lite-relay/main.c                |   4 +-
 examples/default/main.c                       |   4 +-
 examples/ipc_pingpong/main.c                  |   4 +-
 examples/riot_and_cpp/main.cpp                |   2 +-
 examples/rpl_udp/rpl.c                        |   2 +-
 examples/rpl_udp/rpl_udp.h                    |   2 +-
 examples/rpl_udp/udp.c                        |   4 +-
 .../0003-Fix-old-style-definitions.patch      | Bin 52270 -> 52267 bytes
 pkg/openwsn/0005-fixes-to-RIOT-adaption.patch | Bin 89869 -> 89844 bytes
 sys/auto_init/netif/auto_init_kw2xrf.c        |   4 +-
 sys/auto_init/netif/auto_init_ng_at86rf2xx.c  |   4 +-
 sys/auto_init/netif/auto_init_xbee.c          |   4 +-
 sys/cpp11-compat/include/riot/thread.hpp      |   4 +-
 sys/include/net/ng_ipv6.h                     |   4 +-
 sys/include/net/ng_pktdump.h                  |   4 +-
 sys/include/net/ng_sixlowpan.h                |   4 +-
 sys/include/net/ng_udp.h                      |   4 +-
 sys/include/transceiver.h                     |   2 +-
 sys/net/ccn_lite/ccnl-riot-compat.c           |   4 +-
 sys/net/include/rpl.h                         |   2 +-
 sys/net/link_layer/ping/ping.c                |   4 +-
 .../network_layer/sixlowpan/border/border.c   |   6 +-
 .../sixlowpan/border/flowcontrol.c            |   2 +-
 .../sixlowpan/border/flowcontrol.h            |   2 +-
 sys/net/network_layer/sixlowpan/ip.h          |   3 +-
 sys/net/network_layer/sixlowpan/lowpan.c      |  10 +-
 sys/net/network_layer/sixlowpan/mac.c         |   4 +-
 sys/net/routing/aodvv2/aodv.c                 |   8 +-
 sys/net/routing/etx_beaconing.c               |  18 ++--
 sys/net/routing/nhdp/nhdp.c                   |   4 +-
 sys/net/routing/nhdp/nhdp.h                   |   4 +-
 sys/net/routing/rpl/rpl.c                     |   2 +-
 sys/net/transport_layer/tcp/tcp.c             |   4 +-
 sys/net/transport_layer/tcp/tcp.h             |   2 +-
 sys/net/transport_layer/tcp/tcp_timer.h       |   2 +-
 sys/net/transport_layer/udp/udp.c             |   2 +-
 sys/net/transport_layer/udp/udp.h             |   2 +-
 sys/posix/pthread/pthread.c                   |  12 +--
 sys/transceiver/transceiver.c                 |   4 +-
 sys/uart0/uart0.c                             |   4 +-
 .../auto_init_ng_netif/netif_app.c            |  91 ++++++++++++++++++
 .../auto_init_ng_netif/netif_app.c            |  86 +++++++++++++++++
 tests/driver_nrf24l01p_lowlevel/main.c        |   4 +-
 tests/driver_pir/main.c                       |   4 +-
 .../auto_init_ng_netif/netif_app.c            |  77 +++++++++++++++
 tests/irq/main.c                              |   4 +-
 tests/msg_send_receive/main.c                 |   8 +-
 tests/mutex_unlock_and_sleep/main.c           |   4 +-
 tests/nativenet/main.c                        |   4 +-
 tests/periph_uart_int/main.c                  |   4 +-
 tests/pipe/main.c                             |   6 +-
 tests/posix_semaphore/main.c                  |   8 +-
 tests/pthread_condition_variable/main.c       |   4 +-
 tests/pthread_rwlock/main.c                   |  10 +-
 tests/sched_testing/main.c                    |   4 +-
 tests/thread_basic/main.c                     |   4 +-
 tests/thread_cooperation/main.c               |   4 +-
 tests/thread_exit/main.c                      |  10 +-
 tests/thread_msg/main.c                       |  12 +--
 tests/thread_msg_block_w_queue/main.c         |   4 +-
 tests/thread_msg_block_wo_queue/main.c        |   4 +-
 tests/thread_msg_seq/main.c                   |  12 +--
 .../tests-core/tests-core-ringbuffer.c        |   4 +-
 tests/unittests/tests-ubjson/tests-ubjson.c   |   4 +-
 tests/vtimer_msg/main.c                       |   8 +-
 tests/vtimer_msg_diff/main.c                  |   4 +-
 95 files changed, 630 insertions(+), 312 deletions(-)
 create mode 100644 boards/iot-lab_M3/auto_init_ng_netif/netif_board.c
 create mode 100644 tests/driver_at86rf2xx/auto_init_ng_netif/netif_app.c
 create mode 100644 tests/driver_kw2xrf/auto_init_ng_netif/netif_app.c
 create mode 100644 tests/driver_xbee/auto_init_ng_netif/netif_app.c

diff --git a/boards/iot-lab_M3/auto_init_ng_netif/netif_board.c b/boards/iot-lab_M3/auto_init_ng_netif/netif_board.c
new file mode 100644
index 0000000000..79bdb3a5dd
--- /dev/null
+++ b/boards/iot-lab_M3/auto_init_ng_netif/netif_board.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     boards_iot-lab_M3
+ * @{
+ *
+ * @file
+ * @brief       Network device initialization code
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ *
+ * @}
+ */
+
+#include <stdio.h>
+
+#include "board.h"
+#include "auto_init.h"
+#include "ng_at86rf2xx.h"
+#include "net/ng_nomac.h"
+#include "net/ng_netbase.h"
+
+#define ENABLE_DEBUG (0)
+#include "debug.h"
+
+/**
+ * @brief   Define stack parameters for the MAC layer thread
+ * @{
+ */
+#define MAC_STACKSIZE           (THREAD_STACKSIZE_DEFAULT)
+#define MAC_PRIO                (THREAD_PRIORITY_MAIN - 3)
+/** @} */
+
+/**
+ * @brief   Device descriptor for the Atmel radio
+ */
+static ng_at86rf2xx_t radio;
+
+/**
+ * @brief   Stack for the MAC layer thread
+ */
+static char nomac_stack[MAC_STACKSIZE];
+
+
+void auto_init_ng_netif(void)
+{
+    /* initialize the radio */
+    DEBUG("Initializing AT86RF231 radio\n");
+    ng_at86rf2xx_init(&radio, AT86RF231_SPI, AT86RF231_SPI_CLK,
+                      AT86RF231_CS, AT86RF231_INT,
+                      AT86RF231_SLEEP, AT86RF231_RESET);
+    /* starting NOMAC */
+    DEBUG("Starting the MAC layer\n");
+    ng_nomac_init(nomac_stack, sizeof(nomac_stack), MAC_PRIO, "at86rf233",
+                  (ng_netdev_t *)(&radio));
+    DEBUG("Auto init of on-board radio complete\n");
+}
diff --git a/boards/qemu-i386/include/cpu-conf.h b/boards/qemu-i386/include/cpu-conf.h
index 295733099a..a273115f11 100644
--- a/boards/qemu-i386/include/cpu-conf.h
+++ b/boards/qemu-i386/include/cpu-conf.h
@@ -25,12 +25,11 @@ extern "C" {
 
 /* FIXME: This file is just a filler. The numbers are entirely random ... */
 
-#define KERNEL_CONF_STACKSIZE_DEFAULT      (8192)
-#define KERNEL_CONF_STACKSIZE_IDLE         (8192)
-#define KERNEL_CONF_STACKSIZE_PRINTF       (8192)
-#define KERNEL_CONF_STACKSIZE_PRINTF_FLOAT (8192)
-
-#define MINIMUM_STACK_SIZE                 (8192)
+#define THREAD_STACKSIZE_DEFAULT                 (8192)
+#define THREAD_STACKSIZE_IDLE                    (8192)
+#define THREAD_EXTRA_STACKSIZE_PRINTF            (8192)
+#define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT      (8192)
+#define THREAD_STACKSIZE_MINIMUM                 (8192)
 
 #define UART0_BUFSIZE                      (16)
 
diff --git a/boards/samr21-xpro/auto_init_ng_netif/netif_board.c b/boards/samr21-xpro/auto_init_ng_netif/netif_board.c
index 4bcb41e7fb..01555cb517 100644
--- a/boards/samr21-xpro/auto_init_ng_netif/netif_board.c
+++ b/boards/samr21-xpro/auto_init_ng_netif/netif_board.c
@@ -33,8 +33,8 @@
  * @brief   Define stack parameters for the MAC layer thread
  * @{
  */
-#define MAC_STACKSIZE           (KERNEL_CONF_STACKSIZE_DEFAULT)
-#define MAC_PRIO                (PRIORITY_MAIN - 3)
+#define MAC_STACKSIZE           (THREAD_STACKSIZE_DEFAULT)
+#define MAC_PRIO                (THREAD_PRIORITY_MAIN - 3)
 /** @} */
 
 /**
diff --git a/core/include/debug.h b/core/include/debug.h
index b6613b361c..9dec9e2d51 100644
--- a/core/include/debug.h
+++ b/core/include/debug.h
@@ -57,7 +57,7 @@ extern "C" {
 #include "cpu-conf.h"
 #define DEBUG_PRINT(...) \
     do { \
-        if ((sched_active_thread == NULL) || (sched_active_thread->stack_size > KERNEL_CONF_STACKSIZE_PRINTF)) { \
+        if ((sched_active_thread == NULL) || (sched_active_thread->stack_size > THREAD_EXTRA_STACKSIZE_PRINTF)) { \
             printf(__VA_ARGS__); \
         } \
         else { \
diff --git a/core/include/kernel.h b/core/include/kernel.h
index fab35c4bbf..45842c0117 100644
--- a/core/include/kernel.h
+++ b/core/include/kernel.h
@@ -37,57 +37,7 @@
  extern "C" {
 #endif
 
-/**
- * @def KERNEL_CONF_STACKSIZE_DEFAULT
- * @brief A reasonable default stack size that will suffice most smaller tasks
- */
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#error KERNEL_CONF_STACKSIZE_DEFAULT must be defined per CPU
-#endif
-
-/**
- * @def KERNEL_CONF_STACKSIZE_IDLE
- * @brief Size of the idle task's stack in bytes
- */
-#ifndef KERNEL_CONF_STACKSIZE_IDLE
-#error KERNEL_CONF_STACKSIZE_IDLE must be defined per CPU
-#endif
-
-/**
- * @def KERNEL_CONF_STACKSIZE_PRINTF
- * @ingroup conf
- * @brief Size of the task's printf stack in bytes
- */
-#ifndef KERNEL_CONF_STACKSIZE_PRINTF
-#error KERNEL_CONF_STACKSIZE_PRINTF must be defined per CPU
-#endif
-
-/**
- * @def KERNEL_CONF_STACKSIZE_MAIN
- * @brief Size of the main task's stack in bytes
- */
-#ifndef KERNEL_CONF_STACKSIZE_MAIN
-#define KERNEL_CONF_STACKSIZE_MAIN      (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF)
-#endif
-
 /* ------------------------------------------------------------------------- */
-/**
- * @def PRIORITY_MIN
- * @brief Least priority a thread can have
- */
-#define PRIORITY_MIN            (SCHED_PRIO_LEVELS-1)
-
-/**
- * @def PRIORITY_IDLE
- * @brief Priority of the idle thread
- */
-#define PRIORITY_IDLE           PRIORITY_MIN
-
-/**
- * @def PRIORITY_MAIN
- * @brief Priority of the main thread
- */
-#define PRIORITY_MAIN           (PRIORITY_MIN - (SCHED_PRIO_LEVELS/2))
 
 /**
  * @def LPM_PREVENT_SLEEP_UART
diff --git a/core/include/thread.h b/core/include/thread.h
index aa7f8724b2..c3bcbf337f 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -35,13 +35,64 @@
  */
 #define STATUS_NOT_FOUND (-1)
 
+ /**
+ * @def THREAD_STACKSIZE_DEFAULT
+ * @brief A reasonable default stack size that will suffice most smaller tasks
+ */
+#ifndef THREAD_STACKSIZE_DEFAULT
+#error THREAD_STACKSIZE_DEFAULT must be defined per CPU
+#endif
+
+/**
+ * @def THREAD_STACKSIZE_IDLE
+ * @brief Size of the idle task's stack in bytes
+ */
+#ifndef THREAD_STACKSIZE_IDLE
+#error THREAD_STACKSIZE_IDLE must be defined per CPU
+#endif
+
+/**
+ * @def THREAD_EXTRA_STACKSIZE_PRINTF
+ * @ingroup conf
+ * @brief Size of the task's printf stack in bytes
+ */
+#ifndef THREAD_EXTRA_STACKSIZE_PRINTF
+#error THREAD_EXTRA_STACKSIZE_PRINTF must be defined per CPU
+#endif
+
+/**
+ * @def THREAD_STACKSIZE_MAIN
+ * @brief Size of the main task's stack in bytes
+ */
+#ifndef THREAD_STACKSIZE_MAIN
+#define THREAD_STACKSIZE_MAIN      (THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF)
+#endif
+
 /**
  * @brief Minimum stack size
  */
-#ifndef MINIMUM_STACK_SIZE
-#define MINIMUM_STACK_SIZE  (sizeof(tcb_t))
+#ifndef THREAD_STACKSIZE_MINIMUM
+#define THREAD_STACKSIZE_MINIMUM  (sizeof(tcb_t))
 #endif
 
+/**
+ * @def THREAD_PRIORITY_MIN
+ * @brief Least priority a thread can have
+ */
+#define THREAD_PRIORITY_MIN            (SCHED_PRIO_LEVELS-1)
+
+/**
+ * @def THREAD_PRIORITY_IDLE
+ * @brief Priority of the idle thread
+ */
+#define THREAD_PRIORITY_IDLE           (THREAD_PRIORITY_MIN)
+
+/**
+ * @def THREAD_PRIORITY_MAIN
+ * @brief Priority of the main thread
+ */
+#define THREAD_PRIORITY_MAIN           (THREAD_PRIORITY_MIN - (SCHED_PRIO_LEVELS/2))
+
 /**
  * @brief Creates a new thread
  *
@@ -56,7 +107,7 @@
  * A low value for *priority* number means the thread having a high priority
  * with 0 being the highest possible priority.
  *
- * The lowest possible priority is *PRIORITY_IDLE - 1*. The value is depending
+ * The lowest possible priority is *THREAD_PRIORITY_IDLE - 1*. The value is depending
  * on the platforms architecture, e.g. 30 in 32-bit systems, 14 in 16-bit systems.
  *
  *
diff --git a/core/kernel_init.c b/core/kernel_init.c
index 678f9759e8..b18bdb0027 100644
--- a/core/kernel_init.c
+++ b/core/kernel_init.c
@@ -76,8 +76,8 @@ static void *idle_thread(void *arg)
 const char *main_name = "main";
 const char *idle_name = "idle";
 
-static char main_stack[KERNEL_CONF_STACKSIZE_MAIN];
-static char idle_stack[KERNEL_CONF_STACKSIZE_IDLE];
+static char main_stack[THREAD_STACKSIZE_MAIN];
+static char idle_stack[THREAD_STACKSIZE_IDLE];
 
 void kernel_init(void)
 {
@@ -86,12 +86,12 @@ void kernel_init(void)
 
     hwtimer_init();
 
-    if (thread_create(idle_stack, sizeof(idle_stack), PRIORITY_IDLE, CREATE_WOUT_YIELD | CREATE_STACKTEST, idle_thread, NULL, idle_name) < 0) {
-        LOG_ERROR("kernel_init(): error creating idle task.\n");
+    if (thread_create(idle_stack, sizeof(idle_stack), THREAD_PRIORITY_IDLE, CREATE_WOUT_YIELD | CREATE_STACKTEST, idle_thread, NULL, idle_name) < 0) {
+        printf("kernel_init(): error creating idle task.\n");
     }
 
-    if (thread_create(main_stack, sizeof(main_stack), PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST, main_trampoline, NULL, main_name) < 0) {
-        LOG_ERROR("kernel_init(): error creating main task.\n");
+    if (thread_create(main_stack, sizeof(main_stack), THREAD_PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST, main_trampoline, NULL, main_name) < 0) {
+        printf("kernel_init(): error creating main task.\n");
     }
 
     LOG_INFO("kernel_init(): jumping into first task...\n");
diff --git a/core/msg.c b/core/msg.c
index 85cf33e657..850fad03b8 100644
--- a/core/msg.c
+++ b/core/msg.c
@@ -351,7 +351,7 @@ static int _msg_receive(msg_t *m, int block)
         *m = *sender_msg;
 
         /* remove sender from queue */
-        uint16_t sender_prio = PRIORITY_IDLE;
+        uint16_t sender_prio = THREAD_PRIORITY_IDLE;
         if (sender->status != STATUS_REPLY_BLOCKED) {
             sender->wait_data = NULL;
             sched_set_status(sender, STATUS_PENDING);
@@ -359,7 +359,7 @@ static int _msg_receive(msg_t *m, int block)
         }
 
         restoreIRQ(state);
-        if (sender_prio < PRIORITY_IDLE) {
+        if (sender_prio < THREAD_PRIORITY_IDLE) {
             sched_switch(sender_prio);
         }
         return 1;
diff --git a/cpu/atmega2560/include/cpu-conf.h b/cpu/atmega2560/include/cpu-conf.h
index 4e92af4c7a..78c7141ae0 100644
--- a/cpu/atmega2560/include/cpu-conf.h
+++ b/cpu/atmega2560/include/cpu-conf.h
@@ -31,13 +31,13 @@ extern "C" {
  * size tested sucessfully even with pretty small stacks.k
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (128)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (128)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (256)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (256)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (128)
+#define THREAD_STACKSIZE_IDLE      (128)
 /** @} */
 
 /**
diff --git a/cpu/cc2538/include/cpu-conf.h b/cpu/cc2538/include/cpu-conf.h
index 13edbfdd57..b02353d7fb 100644
--- a/cpu/cc2538/include/cpu-conf.h
+++ b/cpu/cc2538/include/cpu-conf.h
@@ -36,13 +36,13 @@ extern "C" {
  * @name Kernel configuration
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    1024
+#define THREAD_EXTRA_STACKSIZE_PRINTF    1024
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   1024
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   1024
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      512
+#define THREAD_STACKSIZE_IDLE      512
 /** @} */
 
 /**
diff --git a/cpu/k60/include/cpu-conf.h b/cpu/k60/include/cpu-conf.h
index 68b33647d5..182ab9715e 100644
--- a/cpu/k60/include/cpu-conf.h
+++ b/cpu/k60/include/cpu-conf.h
@@ -82,13 +82,13 @@ extern "C"
  * TODO: Tune this
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (1024)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (1024)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/kw2x/include/cpu-conf.h b/cpu/kw2x/include/cpu-conf.h
index 2d5d5b4dcd..4fa2df79ab 100644
--- a/cpu/kw2x/include/cpu-conf.h
+++ b/cpu/kw2x/include/cpu-conf.h
@@ -47,13 +47,13 @@ extern "C"
  *
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF     (1024)
+#define THREAD_EXTRA_STACKSIZE_PRINTF     (1024)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT    (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT    (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE       (256)
+#define THREAD_STACKSIZE_IDLE       (256)
 /** @} */
 
 /**
diff --git a/cpu/lpc1768/include/cpu-conf.h b/cpu/lpc1768/include/cpu-conf.h
index 23d65c1eae..6d71a8f809 100644
--- a/cpu/lpc1768/include/cpu-conf.h
+++ b/cpu/lpc1768/include/cpu-conf.h
@@ -36,13 +36,13 @@ extern "C" {
  * TODO: measure and adjust for the Cortex-M3
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (1024)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (1024)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/lpc2387/include/cpu-conf.h b/cpu/lpc2387/include/cpu-conf.h
index 16745eb743..29129fcbfe 100644
--- a/cpu/lpc2387/include/cpu-conf.h
+++ b/cpu/lpc2387/include/cpu-conf.h
@@ -43,14 +43,14 @@ extern "C" {
  * @name Kernel configuration
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF_FLOAT  (4096)
-#define KERNEL_CONF_STACKSIZE_PRINTF        (2048)
+#define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT  (4096)
+#define THREAD_EXTRA_STACKSIZE_PRINTF        (2048)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (512)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (512)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (160)
+#define THREAD_STACKSIZE_IDLE      (160)
 /** @} */
 
 /**
diff --git a/cpu/mc1322x/include/cpu-conf.h b/cpu/mc1322x/include/cpu-conf.h
index 28c966f1b5..2cfe4d1e4c 100644
--- a/cpu/mc1322x/include/cpu-conf.h
+++ b/cpu/mc1322x/include/cpu-conf.h
@@ -40,14 +40,14 @@ extern "C" {
  * @name Kernel configuration
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF_FLOAT  (4096)
-#define KERNEL_CONF_STACKSIZE_PRINTF        (2048)
+#define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT  (4096)
+#define THREAD_EXTRA_STACKSIZE_PRINTF        (2048)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (512)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (512)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE  (160)
+#define THREAD_STACKSIZE_IDLE  (160)
 /** @} */
 
 /**
diff --git a/cpu/msp430-common/include/cpu-conf.h b/cpu/msp430-common/include/cpu-conf.h
index cb3fa35cee..9ddff3d20c 100644
--- a/cpu/msp430-common/include/cpu-conf.h
+++ b/cpu/msp430-common/include/cpu-conf.h
@@ -17,14 +17,14 @@ extern "C" {
  * @name Kernel configuration
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (256)
-#define KERNEL_CONF_STACKSIZE_PRINTF_FLOAT (KERNEL_CONF_STACKSIZE_PRINTF)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (256)
+#define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT (THREAD_EXTRA_STACKSIZE_PRINTF)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (256)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (256)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (96)
+#define THREAD_STACKSIZE_IDLE      (96)
 #define MSP430_ISR_STACK_SIZE           (256)
 
 #define RX_BUF_SIZE (3)
diff --git a/cpu/native/include/cpu-conf.h b/cpu/native/include/cpu-conf.h
index 3cf26d05e6..ffa9e72074 100644
--- a/cpu/native/include/cpu-conf.h
+++ b/cpu/native/include/cpu-conf.h
@@ -22,28 +22,28 @@ extern "C" {
 
 /* TODO: tighten stack sizes */
 #ifdef __MACH__ /* OSX */
-#define KERNEL_CONF_STACKSIZE_DEFAULT       (163840)
-#define KERNEL_CONF_STACKSIZE_IDLE          (163840)
-#define KERNEL_CONF_STACKSIZE_PRINTF        (163840)
-#define KERNEL_CONF_STACKSIZE_PRINTF_FLOAT  (163840)
+#define THREAD_STACKSIZE_DEFAULT       (163840)
+#define THREAD_STACKSIZE_IDLE          (163840)
+#define THREAD_EXTRA_STACKSIZE_PRINTF        (163840)
+#define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT  (163840)
 /* for core/include/thread.h */
-#define MINIMUM_STACK_SIZE              (163840)
+#define THREAD_STACKSIZE_MINIMUM              (163840)
 /* undefine the TRANSCEIVER_STACK_SIZE (2048 or 512) defined in transceiver.h */
 #ifdef TRANSCEIVER_STACK_SIZE
 #undef TRANSCEIVER_STACK_SIZE
 #endif
 #define TRANSCEIVER_STACK_SIZE          (163840)
 /* native internal */
-#define MINIMUM_STACK_SIZE              (163840)
+#define THREAD_STACKSIZE_MINIMUM              (163840)
 #define NATIVE_ISR_STACKSIZE            (163840)
 
 #else /* Linux etc. */
-#define KERNEL_CONF_STACKSIZE_DEFAULT       (8192)
-#define KERNEL_CONF_STACKSIZE_IDLE          (8192)
-#define KERNEL_CONF_STACKSIZE_PRINTF        (8192)
-#define KERNEL_CONF_STACKSIZE_PRINTF_FLOAT  (8192)
+#define THREAD_STACKSIZE_DEFAULT       (8192)
+#define THREAD_STACKSIZE_IDLE          (8192)
+#define THREAD_EXTRA_STACKSIZE_PRINTF        (8192)
+#define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT  (8192)
 /* for core/include/thread.h */
-#define MINIMUM_STACK_SIZE              (8192)
+#define THREAD_STACKSIZE_MINIMUM              (8192)
 /* undefine the TRANSCEIVER_STACK_SIZE (2048 or 512) defined in transceiver.h */
 #ifdef TRANSCEIVER_STACK_SIZE
 #undef TRANSCEIVER_STACK_SIZE
diff --git a/cpu/nrf51822/include/cpu-conf.h b/cpu/nrf51822/include/cpu-conf.h
index 21654f91c5..b048198096 100644
--- a/cpu/nrf51822/include/cpu-conf.h
+++ b/cpu/nrf51822/include/cpu-conf.h
@@ -30,13 +30,13 @@ extern "C" {
  * @name Kernel configuration
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (512)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (512)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/sam3x8e/include/cpu-conf.h b/cpu/sam3x8e/include/cpu-conf.h
index bf5d646d7f..ccd8f7edd6 100644
--- a/cpu/sam3x8e/include/cpu-conf.h
+++ b/cpu/sam3x8e/include/cpu-conf.h
@@ -30,13 +30,13 @@ extern "C" {
  * TODO: measure and adjust for the cortex-m3
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (2500)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (2500)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (2500)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (2500)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (512)
+#define THREAD_STACKSIZE_IDLE      (512)
 /** @} */
 
 /**
diff --git a/cpu/samd21/include/cpu-conf.h b/cpu/samd21/include/cpu-conf.h
index f78e6e6c35..ea02b51a79 100644
--- a/cpu/samd21/include/cpu-conf.h
+++ b/cpu/samd21/include/cpu-conf.h
@@ -30,13 +30,13 @@ extern "C" {
  * TODO: measure and adjust for the cortex-m0
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (512)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (512)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/stm32f0/include/cpu-conf.h b/cpu/stm32f0/include/cpu-conf.h
index 9083771dd4..05ff0c7935 100644
--- a/cpu/stm32f0/include/cpu-conf.h
+++ b/cpu/stm32f0/include/cpu-conf.h
@@ -41,13 +41,13 @@ extern "C" {
  * TODO: measure and adjust for the Cortex-M0
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (512)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (512)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (512)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (512)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (192)
+#define THREAD_STACKSIZE_IDLE      (192)
 /** @} */
 
 /**
diff --git a/cpu/stm32f1/include/cpu-conf.h b/cpu/stm32f1/include/cpu-conf.h
index 6cbf818b0c..c28dc74311 100644
--- a/cpu/stm32f1/include/cpu-conf.h
+++ b/cpu/stm32f1/include/cpu-conf.h
@@ -35,13 +35,13 @@ extern "C" {
  * TODO: measure and adjust for the cortex-m3
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (1024)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (1024)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/stm32f3/include/cpu-conf.h b/cpu/stm32f3/include/cpu-conf.h
index 1b22573140..f469fb4572 100644
--- a/cpu/stm32f3/include/cpu-conf.h
+++ b/cpu/stm32f3/include/cpu-conf.h
@@ -34,13 +34,13 @@
  * TODO: measure and adjust for the Cortex-M4f
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (1024)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (1024)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/stm32f4/include/cpu-conf.h b/cpu/stm32f4/include/cpu-conf.h
index c77ccf1411..ef4ba0b0a9 100644
--- a/cpu/stm32f4/include/cpu-conf.h
+++ b/cpu/stm32f4/include/cpu-conf.h
@@ -33,13 +33,13 @@
  * TODO: measure and adjust for the Cortex-M4f
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (2500)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (2500)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (2500)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (2500)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (512)
+#define THREAD_STACKSIZE_IDLE      (512)
 /** @} */
 
 /**
diff --git a/cpu/stm32l1/include/cpu-conf.h b/cpu/stm32l1/include/cpu-conf.h
index b9ec2c6766..b6badbc600 100644
--- a/cpu/stm32l1/include/cpu-conf.h
+++ b/cpu/stm32l1/include/cpu-conf.h
@@ -32,13 +32,13 @@ extern "C" {
  *
  * @{
  */
-#define KERNEL_CONF_STACKSIZE_PRINTF    (1024)
+#define THREAD_EXTRA_STACKSIZE_PRINTF    (1024)
 
-#ifndef KERNEL_CONF_STACKSIZE_DEFAULT
-#define KERNEL_CONF_STACKSIZE_DEFAULT   (1024)
+#ifndef THREAD_STACKSIZE_DEFAULT
+#define THREAD_STACKSIZE_DEFAULT   (1024)
 #endif
 
-#define KERNEL_CONF_STACKSIZE_IDLE      (256)
+#define THREAD_STACKSIZE_IDLE      (256)
 /** @} */
 
 /**
diff --git a/cpu/x86/x86_hwtimer.c b/cpu/x86/x86_hwtimer.c
index 9484e1a626..d077fe3659 100644
--- a/cpu/x86/x86_hwtimer.c
+++ b/cpu/x86/x86_hwtimer.c
@@ -166,7 +166,7 @@ void x86_init_hwtimer(void)
 
 static void (*hwtimer_callback)(int timer);
 
-static char hwtimer_stack[KERNEL_CONF_STACKSIZE_DEFAULT];
+static char hwtimer_stack[THREAD_STACKSIZE_DEFAULT];
 static kernel_pid_t hwtimer_pid = KERNEL_PID_UNDEF;
 
 struct alarm_time {
diff --git a/doc/doxygen/src/mainpage.txt b/doc/doxygen/src/mainpage.txt
index 9212b8de3d..b57330f6b4 100644
--- a/doc/doxygen/src/mainpage.txt
+++ b/doc/doxygen/src/mainpage.txt
@@ -138,24 +138,24 @@
  * `cpu-conf.` (which should be provided by the implementation for all
  * supported MCUs). The constants for these stack sizes are
  *
- * * `KERNEL_CONF_STACKSIZE_IDLE`
- * * `KERNEL_CONF_STACKSIZE_DEFAULT`
- * * `KERNEL_CONF_STACKSIZE_PRINTF`
- * * `KERNEL_CONF_STACKSIZE_MAIN`
+ * * `THREAD_STACKSIZE_IDLE`
+ * * `THREAD_STACKSIZE_DEFAULT`
+ * * `THREAD_EXTRA_STACKSIZE_PRINTF`
+ * * `THREAD_STACKSIZE_MAIN`
  *
  * and can be used by including `kernel.h`. ARM based platforms additionally
- * define `KERNEL_CONF_STACKSIZE_PRINTF_FLOAT`, because newlibs printf
+ * define `THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT`, because newlibs printf
  * implementation uses more memory for printing floating point numbers.
  *
- * `KERNEL_CONF_STACKSIZE_IDLE` is the stack size for the idle thread and
- * probably the smallest sensible stack size. `KERNEL_CONF_STACKSIZE_DEFAULT`
+ * `THREAD_STACKSIZE_IDLE` is the stack size for the idle thread and
+ * probably the smallest sensible stack size. `THREAD_STACKSIZE_DEFAULT`
  * is a default size for any typical thread, _not_ using printf.
- * `KERNEL_CONF_STACKSIZE_PRINTF` defines additional stack space needed if the
+ * `THREAD_EXTRA_STACKSIZE_PRINTF` defines additional stack space needed if the
  * thread needs to call printf (which requires additional memory when using
- * newlib). `KERNEL_CONF_STACKSIZE_MAIN` is the stack size for the main thread
+ * newlib). `THREAD_STACKSIZE_MAIN` is the stack size for the main thread
  * and probably a good size for your application. (Note, that on most
  * non-newlib dependent platforms this will probably equal
- * `KERNEL_CONF_STACKSIZE_DEFAULT`.
+ * `THREAD_STACKSIZE_DEFAULT`.
  *
  * ####The IPC
  *
diff --git a/drivers/cc110x_legacy_csma/cc1100_phy.c b/drivers/cc110x_legacy_csma/cc1100_phy.c
index 639cb50163..b3d3419d05 100644
--- a/drivers/cc110x_legacy_csma/cc1100_phy.c
+++ b/drivers/cc110x_legacy_csma/cc1100_phy.c
@@ -42,7 +42,7 @@
 #include "msg.h"
 #include "debug.h"
 
-#define PRIORITY_CC1100         PRIORITY_MAIN-1
+#define PRIORITY_CC1100         THREAD_PRIORITY_MAIN-1
 
 #define MSG_POLL 12346
 
@@ -83,7 +83,7 @@ static timex_t cc1100_watch_dog_period;
 static kernel_pid_t cc1100_event_handler_pid;
 static void *cc1100_event_handler_function(void *);
 
-static char event_handler_stack[KERNEL_CONF_STACKSIZE_MAIN];
+static char event_handler_stack[THREAD_STACKSIZE_MAIN];
 
 /*---------------------------------------------------------------------------*/
 /*              Sequence number buffer management data structures */
diff --git a/examples/ccn-lite-client/main.c b/examples/ccn-lite-client/main.c
index 77481acc95..862e2523c0 100644
--- a/examples/ccn-lite-client/main.c
+++ b/examples/ccn-lite-client/main.c
@@ -44,10 +44,10 @@
 
 static const char DEFAULT_INTEREST[] = "/ccnx/0.7.1/doc/technical/CanonicalOrder.txt";
 
-char relay_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char relay_stack[THREAD_STACKSIZE_MAIN];
 
 #if RIOT_CCN_APPSERVER
-char appserver_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char appserver_stack[THREAD_STACKSIZE_MAIN];
 #endif
 static volatile kernel_pid_t _relay_pid = KERNEL_PID_UNDEF, _appserver_pid = KERNEL_PID_UNDEF;
 
@@ -72,7 +72,7 @@ static int riot_ccn_appserver(int argc, char **argv)
 
     _appserver_pid = thread_create(
             appserver_stack, sizeof(appserver_stack),
-            PRIORITY_MAIN - 1, CREATE_STACKTEST,
+            THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
             ccnl_riot_appserver_start, (void *) &_relay_pid, "appserver");
     DEBUG("ccn-lite appserver on thread_id %" PRIkernel_pid "...\n", _appserver_pid);
 
@@ -186,7 +186,7 @@ static int riot_ccn_relay_start(void)
 
     _relay_pid = thread_create(
             relay_stack, sizeof(relay_stack),
-            PRIORITY_MAIN - 2, CREATE_STACKTEST,
+            THREAD_PRIORITY_MAIN - 2, CREATE_STACKTEST,
             ccnl_riot_relay_start, NULL, "relay");
     DEBUG("ccn-lite relay on thread_id %" PRIkernel_pid "...\n", _relay_pid);
 
diff --git a/examples/ccn-lite-relay/main.c b/examples/ccn-lite-relay/main.c
index 6684116026..e7dc9b62d8 100644
--- a/examples/ccn-lite-relay/main.c
+++ b/examples/ccn-lite-relay/main.c
@@ -33,7 +33,7 @@
 
 static kernel_pid_t _relay_pid = KERNEL_PID_UNDEF;
 
-char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char t2_stack[THREAD_STACKSIZE_MAIN];
 
 void set_address_handler(uint16_t a)
 {
@@ -75,7 +75,7 @@ int main(void)
 
     _relay_pid = thread_getpid();
 
-    thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN + 1,
+    thread_create(t2_stack, sizeof(t2_stack), THREAD_PRIORITY_MAIN + 1,
                   CREATE_STACKTEST, second_thread, NULL, "helper thread");
 
     printf("starting ccn-lite relay...\n");
diff --git a/examples/default/main.c b/examples/default/main.c
index 0829513c4b..186df320ed 100644
--- a/examples/default/main.c
+++ b/examples/default/main.c
@@ -49,7 +49,7 @@
 
 #define SND_BUFFER_SIZE     (100)
 #define RCV_BUFFER_SIZE     (64)
-#define RADIO_STACK_SIZE    (KERNEL_CONF_STACKSIZE_MAIN)
+#define RADIO_STACK_SIZE    (THREAD_STACKSIZE_MAIN)
 
 #ifdef MODULE_TRANSCEIVER
 
@@ -121,7 +121,7 @@ void init_transceiver(void)
     kernel_pid_t radio_pid = thread_create(
                         radio_stack_buffer,
                         sizeof(radio_stack_buffer),
-                        PRIORITY_MAIN - 2,
+                        THREAD_PRIORITY_MAIN - 2,
                         CREATE_STACKTEST,
                         radio,
                         NULL,
diff --git a/examples/ipc_pingpong/main.c b/examples/ipc_pingpong/main.c
index de2bec1972..f3fd69daf9 100644
--- a/examples/ipc_pingpong/main.c
+++ b/examples/ipc_pingpong/main.c
@@ -41,7 +41,7 @@ void *second_thread(void *arg)
     return NULL;
 }
 
-char second_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char second_thread_stack[THREAD_STACKSIZE_MAIN];
 
 int main(void)
 {
@@ -51,7 +51,7 @@ int main(void)
     msg_t m;
 
     kernel_pid_t pid = thread_create(second_thread_stack, sizeof(second_thread_stack),
-                            PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                            THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                             second_thread, NULL, "pong");
 
     m.content.value = 1;
diff --git a/examples/riot_and_cpp/main.cpp b/examples/riot_and_cpp/main.cpp
index 4e03c8738e..0c7ba56042 100644
--- a/examples/riot_and_cpp/main.cpp
+++ b/examples/riot_and_cpp/main.cpp
@@ -37,7 +37,7 @@ extern "C" {
 using namespace std;
 
 /* thread's stack */
-char threadA_stack [KERNEL_CONF_STACKSIZE_MAIN];
+char threadA_stack [THREAD_STACKSIZE_MAIN];
 
 /* thread's function */
 void *threadA_func(void *arg);
diff --git a/examples/rpl_udp/rpl.c b/examples/rpl_udp/rpl.c
index 43d4364969..0973238995 100644
--- a/examples/rpl_udp/rpl.c
+++ b/examples/rpl_udp/rpl.c
@@ -144,7 +144,7 @@ int rpl_udp_init(int argc, char **argv)
         DEBUGF("Start monitor\n");
         kernel_pid_t monitor_pid = thread_create(monitor_stack_buffer,
                                                  sizeof(monitor_stack_buffer),
-                                                 PRIORITY_MAIN - 2,
+                                                 THREAD_PRIORITY_MAIN - 2,
                                                  CREATE_STACKTEST,
                                                  rpl_udp_monitor,
                                                  NULL,
diff --git a/examples/rpl_udp/rpl_udp.h b/examples/rpl_udp/rpl_udp.h
index bb23537167..a650b659f5 100644
--- a/examples/rpl_udp/rpl_udp.h
+++ b/examples/rpl_udp/rpl_udp.h
@@ -17,7 +17,7 @@ extern "C" {
 
 #define RADIO_CHANNEL   (10)
 
-#define MONITOR_STACK_SIZE  (KERNEL_CONF_STACKSIZE_MAIN)
+#define MONITOR_STACK_SIZE  (THREAD_STACKSIZE_MAIN)
 #define RCV_BUFFER_SIZE     (32)
 
 /* RPL shell command handlers */
diff --git a/examples/rpl_udp/udp.c b/examples/rpl_udp/udp.c
index c2401bb18f..a58e2a629e 100644
--- a/examples/rpl_udp/udp.c
+++ b/examples/rpl_udp/udp.c
@@ -35,7 +35,7 @@
 #define UDP_BUFFER_SIZE     (128)
 #define SERVER_PORT     (0xFF01)
 
-static char udp_server_stack_buffer[KERNEL_CONF_STACKSIZE_MAIN];
+static char udp_server_stack_buffer[THREAD_STACKSIZE_MAIN];
 char addr_str[IPV6_MAX_ADDR_STR_LEN];
 
 static void *init_udp_server(void *);
@@ -48,7 +48,7 @@ int udp_server(int argc, char **argv)
 
     kernel_pid_t udp_server_thread_pid = thread_create(udp_server_stack_buffer,
                                                        sizeof(udp_server_stack_buffer),
-                                                       PRIORITY_MAIN, CREATE_STACKTEST,
+                                                       THREAD_PRIORITY_MAIN, CREATE_STACKTEST,
                                                        init_udp_server,
                                                        NULL,
                                                        "init_udp_server");
diff --git a/pkg/openwsn/0003-Fix-old-style-definitions.patch b/pkg/openwsn/0003-Fix-old-style-definitions.patch
index 97e9b66e57e96c88725d7aa5ee3e144cb37abe30..d5434b89f4923db3416d7fe22626e2f54afeed0e 100644
GIT binary patch
delta 45
scmZ2CgL(A~<_#vt*g`ylTpe8|+aG%jWp36zzJ{3{A{@W@=BZFd0Fv<$Q2+n{

delta 47
tcmZ2IgL&Ny<_#vtxV>G2{9JwFo&EjXCR-hQjLhGxe0&Y_=4+=y83C>?5=Q_4

diff --git a/pkg/openwsn/0005-fixes-to-RIOT-adaption.patch b/pkg/openwsn/0005-fixes-to-RIOT-adaption.patch
index 55f8c44eb1949c746dab1a1d62f4dacf4c18794a..ddf8e7e896a6f7e1b65af11f57438162c480cea4 100644
GIT binary patch
delta 80
zcmeC($NFV2Yr_`Cj9|79k04h^m+8g9j4n|2_Cvvpri?HSQz)YV6O1Dp&gcx2nJyd7
MxNEy=B;yNK0RKN1%m4rY

delta 105
zcmeyem$i2vYr_`Cj9_kW*C0PvpLl0~Key?5!Hh1*0^4^4Gnz7@h<pxV6ktLT;S6VV
SMo}}JGn{ePcAiMa7pwsN#2`xm

diff --git a/sys/auto_init/netif/auto_init_kw2xrf.c b/sys/auto_init/netif/auto_init_kw2xrf.c
index a2bd4e2de1..e3819078eb 100644
--- a/sys/auto_init/netif/auto_init_kw2xrf.c
+++ b/sys/auto_init/netif/auto_init_kw2xrf.c
@@ -35,8 +35,8 @@
  * @brief   Define stack parameters for the MAC layer thread
  * @{
  */
-#define KW2XRF_MAC_STACKSIZE     (KERNEL_CONF_STACKSIZE_DEFAULT)
-#define KW2XRF_MAC_PRIO          (PRIORITY_MAIN - 3)
+#define KW2XRF_MAC_STACKSIZE     (THREAD_STACKSIZE_DEFAULT)
+#define KW2XRF_MAC_PRIO          (THREAD_PRIORITY_MAIN - 3)
 
 #define KW2XRF_NUM (sizeof(kw2xrf_params)/sizeof(kw2xrf_params[0]))
 
diff --git a/sys/auto_init/netif/auto_init_ng_at86rf2xx.c b/sys/auto_init/netif/auto_init_ng_at86rf2xx.c
index 0cd4cf72c5..de872d1ba1 100644
--- a/sys/auto_init/netif/auto_init_ng_at86rf2xx.c
+++ b/sys/auto_init/netif/auto_init_ng_at86rf2xx.c
@@ -33,8 +33,8 @@
  * @brief   Define stack parameters for the MAC layer thread
  * @{
  */
-#define AT86RF2XX_MAC_STACKSIZE     (KERNEL_CONF_STACKSIZE_DEFAULT)
-#define AT86RF2XX_MAC_PRIO          (PRIORITY_MAIN - 3)
+#define AT86RF2XX_MAC_STACKSIZE     (THREAD_STACKSIZE_DEFAULT)
+#define AT86RF2XX_MAC_PRIO          (THREAD_PRIORITY_MAIN - 3)
 
 #define AT86RF2XX_NUM (sizeof(at86rf2xx_params)/sizeof(at86rf2xx_params[0]))
 
diff --git a/sys/auto_init/netif/auto_init_xbee.c b/sys/auto_init/netif/auto_init_xbee.c
index 0c8798e2d5..4fc932abc3 100644
--- a/sys/auto_init/netif/auto_init_xbee.c
+++ b/sys/auto_init/netif/auto_init_xbee.c
@@ -37,8 +37,8 @@ static xbee_t xbee_devs[XBEE_NUM];
  * @brief   Define stack parameters for the MAC layer thread
  * @{
  */
-#define XBEE_MAC_STACKSIZE           (KERNEL_CONF_STACKSIZE_DEFAULT)
-#define XBEE_MAC_PRIO                (PRIORITY_MAIN - 3)
+#define XBEE_MAC_STACKSIZE           (THREAD_STACKSIZE_DEFAULT)
+#define XBEE_MAC_PRIO                (THREAD_PRIORITY_MAIN - 3)
 
 /**
  * @brief   Stacks for the MAC layer threads
diff --git a/sys/cpp11-compat/include/riot/thread.hpp b/sys/cpp11-compat/include/riot/thread.hpp
index 05a9ffae9f..8430f09d13 100644
--- a/sys/cpp11-compat/include/riot/thread.hpp
+++ b/sys/cpp11-compat/include/riot/thread.hpp
@@ -47,7 +47,7 @@ namespace riot {
 
 namespace {
 constexpr kernel_pid_t thread_uninitialized = -1;
-constexpr size_t stack_size = KERNEL_CONF_STACKSIZE_MAIN;
+constexpr size_t stack_size = THREAD_STACKSIZE_MAIN;
 }
 
 struct thread_data {
@@ -228,7 +228,7 @@ thread::thread(F&& f, Args&&... args)
   std::unique_ptr<func_and_args> p(
     new func_and_args(m_data.get(), forward<F>(f), forward<Args>(args)...));
   m_handle = thread_create(
-    m_data->stack, stack_size, PRIORITY_MAIN - 1, 0, // CREATE_WOUT_YIELD
+    m_data->stack, stack_size, THREAD_PRIORITY_MAIN - 1, 0, // CREATE_WOUT_YIELD
     &thread_proxy<func_and_args>, p.get(), "riot_cpp_thread");
   if (m_handle >= 0) {
     p.release();
diff --git a/sys/include/net/ng_ipv6.h b/sys/include/net/ng_ipv6.h
index b7415de35c..f30cf59250 100644
--- a/sys/include/net/ng_ipv6.h
+++ b/sys/include/net/ng_ipv6.h
@@ -45,14 +45,14 @@ extern "C" {
  * @brief   Default stack size to use for the IPv6 thread
  */
 #ifndef NG_IPV6_STACK_SIZE
-#define NG_IPV6_STACK_SIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define NG_IPV6_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
 #endif
 
 /**
  * @brief   Default priority for the IPv6 thread
  */
 #ifndef NG_IPV6_PRIO
-#define NG_IPV6_PRIO            (PRIORITY_MAIN - 3)
+#define NG_IPV6_PRIO            (THREAD_PRIORITY_MAIN - 3)
 #endif
 
 /**
diff --git a/sys/include/net/ng_pktdump.h b/sys/include/net/ng_pktdump.h
index e69d3946a4..d3ca43fd3a 100644
--- a/sys/include/net/ng_pktdump.h
+++ b/sys/include/net/ng_pktdump.h
@@ -39,14 +39,14 @@ extern "C" {
  * @brief   Priority of the pktdump thread
  */
 #ifndef NG_PKTDUMP_PRIO
-#define NG_PKTDUMP_PRIO                 (PRIORITY_MAIN - 1)
+#define NG_PKTDUMP_PRIO                 (THREAD_PRIORITY_MAIN - 1)
 #endif
 
 /**
  * @brief   Stack size used for the pktdump thread
  */
 #ifndef NG_PKTDUMP_STACKSIZE
-#define NG_PKTDUMP_STACKSIZE            (KERNEL_CONF_STACKSIZE_MAIN)
+#define NG_PKTDUMP_STACKSIZE            (THREAD_STACKSIZE_MAIN)
 #endif
 
 /**
diff --git a/sys/include/net/ng_sixlowpan.h b/sys/include/net/ng_sixlowpan.h
index 5af14b2018..d05524eaf4 100644
--- a/sys/include/net/ng_sixlowpan.h
+++ b/sys/include/net/ng_sixlowpan.h
@@ -34,14 +34,14 @@ extern "C" {
  * @brief   Default stack size to use for the 6LoWPAN thread
  */
 #ifndef NG_SIXLOWPAN_STACK_SIZE
-#define NG_SIXLOWPAN_STACK_SIZE  (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define NG_SIXLOWPAN_STACK_SIZE  (THREAD_STACKSIZE_DEFAULT)
 #endif
 
 /**
  * @brief   Default priority for the 6LoWPAN thread
  */
 #ifndef NG_SIXLOWPAN_PRIO
-#define NG_SIXLOWPAN_PRIO   (PRIORITY_MAIN - 4)
+#define NG_SIXLOWPAN_PRIO   (THREAD_PRIORITY_MAIN - 4)
 #endif
 
 /**
diff --git a/sys/include/net/ng_udp.h b/sys/include/net/ng_udp.h
index 6fd3862069..1c21c9a736 100644
--- a/sys/include/net/ng_udp.h
+++ b/sys/include/net/ng_udp.h
@@ -42,14 +42,14 @@ extern "C" {
  * @brief   Priority of the pktdump thread
  */
 #ifndef NG_UDP_PRIO
-#define NG_UDP_PRIO             (PRIORITY_MAIN - 2)
+#define NG_UDP_PRIO             (THREAD_PRIORITY_MAIN - 2)
 #endif
 
 /**
  * @brief   Default stack size to use for the UDP thread
  */
 #ifndef NG_UDP_STACK_SIZE
-#define NG_UDP_STACK_SIZE       (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define NG_UDP_STACK_SIZE       (THREAD_STACKSIZE_DEFAULT)
 #endif
 
 /**
diff --git a/sys/include/transceiver.h b/sys/include/transceiver.h
index 6fbf018cb0..b06918deb3 100644
--- a/sys/include/transceiver.h
+++ b/sys/include/transceiver.h
@@ -95,7 +95,7 @@ extern "C" {
  * @brief Stack size for transceiver thread
  */
 #ifndef TRANSCEIVER_STACK_SIZE
-#define TRANSCEIVER_STACK_SIZE      (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define TRANSCEIVER_STACK_SIZE      (THREAD_STACKSIZE_DEFAULT)
 #endif
 
 /**
diff --git a/sys/net/ccn_lite/ccnl-riot-compat.c b/sys/net/ccn_lite/ccnl-riot-compat.c
index 30913caf9c..b471e7b944 100644
--- a/sys/net/ccn_lite/ccnl-riot-compat.c
+++ b/sys/net/ccn_lite/ccnl-riot-compat.c
@@ -40,7 +40,7 @@ radio_packet_t p;
 transceiver_command_t tcmd;
 msg_t mesg, rep;
 
-char relay_helper_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char relay_helper_stack[THREAD_STACKSIZE_MAIN];
 
 int riot_send_transceiver(uint8_t *buf, uint16_t size, uint16_t to)
 {
@@ -117,7 +117,7 @@ void *ccnl_riot_relay_helper_start(void *);
 kernel_pid_t riot_start_helper_thread(void)
 {
     return thread_create(relay_helper_stack, sizeof(relay_helper_stack),
-                         PRIORITY_MAIN - 2, CREATE_STACKTEST,
+                         THREAD_PRIORITY_MAIN - 2, CREATE_STACKTEST,
                          ccnl_riot_relay_helper_start, NULL, "relay-helper");
 }
 
diff --git a/sys/net/include/rpl.h b/sys/net/include/rpl.h
index e2cfd01676..3168483cbf 100644
--- a/sys/net/include/rpl.h
+++ b/sys/net/include/rpl.h
@@ -42,7 +42,7 @@ extern "C" {
 #define CC1100_RADIO_MODE CC1100_MODE_WOR
 
 #define RPL_PKT_RECV_BUF_SIZE 16
-#define RPL_PROCESS_STACKSIZE KERNEL_CONF_STACKSIZE_MAIN
+#define RPL_PROCESS_STACKSIZE THREAD_STACKSIZE_MAIN
 
 /* global variables */
 extern kernel_pid_t rpl_process_pid;
diff --git a/sys/net/link_layer/ping/ping.c b/sys/net/link_layer/ping/ping.c
index 06989764a0..ffe3c4ba57 100644
--- a/sys/net/link_layer/ping/ping.c
+++ b/sys/net/link_layer/ping/ping.c
@@ -34,7 +34,7 @@
 /*--------------------------------------------------------------------------------------*/
 /* interal defines */
 #define RCV_BUFFER_SIZE     (64)
-#define RADIO_STACK_SIZE    (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define RADIO_STACK_SIZE    (THREAD_STACKSIZE_DEFAULT)
 #define MAX_PROB_STATS      (64)
 
 /* internal prototypes */
@@ -71,7 +71,7 @@ void l2_ping_init(void)
     mutex_init(&ping_sender_mutex);
     kernel_pid_t l2_pkt_handler_pid = thread_create(l2_pkt_handler_stack_buffer,
                                                     RADIO_STACK_SIZE,
-                                                    PRIORITY_MAIN - 2,
+                                                    THREAD_PRIORITY_MAIN - 2,
                                                     CREATE_STACKTEST,
                                                     l2_pkt_handler, NULL,
                                                     "l2_pkt_handler");
diff --git a/sys/net/network_layer/sixlowpan/border/border.c b/sys/net/network_layer/sixlowpan/border/border.c
index bfb4cdf15c..808b1f932c 100644
--- a/sys/net/network_layer/sixlowpan/border/border.c
+++ b/sys/net/network_layer/sixlowpan/border/border.c
@@ -41,7 +41,7 @@
 #define ENABLE_DEBUG    (0)
 #include "debug.h"
 
-#define READER_STACK_SIZE   (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define READER_STACK_SIZE   (THREAD_STACKSIZE_DEFAULT)
 
 char serial_reader_stack[READER_STACK_SIZE];
 kernel_pid_t serial_reader_pid = KERNEL_PID_UNDEF;
@@ -130,10 +130,10 @@ int sixlowpan_lowpan_border_init(int if_id)
 
     serial_reader_pid = thread_create(
                             serial_reader_stack, READER_STACK_SIZE,
-                            PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                            THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                             serial_reader_f, "serial_reader");
     ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
-                                   PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                   THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                    border_process_lowpan,
                                    "border_process_lowpan");
 
diff --git a/sys/net/network_layer/sixlowpan/border/flowcontrol.c b/sys/net/network_layer/sixlowpan/border/flowcontrol.c
index 56a0d08680..d890045626 100644
--- a/sys/net/network_layer/sixlowpan/border/flowcontrol.c
+++ b/sys/net/network_layer/sixlowpan/border/flowcontrol.c
@@ -59,7 +59,7 @@ ipv6_addr_t init_threeway_handshake(void)
     synack->type = BORDER_PACKET_CONF_TYPE;
     synack->conftype = BORDER_CONF_SYNACK;
 
-    sending_slot_pid = thread_create(sending_slot_stack, SENDING_SLOT_STACK_SIZE, PRIORITY_MAIN - 1, CREATE_SLEEPING, sending_slot, "sending slot");
+    sending_slot_pid = thread_create(sending_slot_stack, SENDING_SLOT_STACK_SIZE, THREAD_PRIORITY_MAIN - 1, CREATE_SLEEPING, sending_slot, "sending slot");
     flowcontrol_send_over_uart((border_packet_t *)synack, sizeof(border_conf_header_t));
 
     synack_seqnum = synack->seq_num;
diff --git a/sys/net/network_layer/sixlowpan/border/flowcontrol.h b/sys/net/network_layer/sixlowpan/border/flowcontrol.h
index 49d059f564..013291606e 100644
--- a/sys/net/network_layer/sixlowpan/border/flowcontrol.h
+++ b/sys/net/network_layer/sixlowpan/border/flowcontrol.h
@@ -43,7 +43,7 @@ extern "C" {
 #define BORDER_RWS                (1)
 #define BORDER_SL_TIMEOUT         (500) // microseconds, maybe smaller
 
-#define SENDING_SLOT_STACK_SIZE     (MINIMUM_STACK_SIZE + 256)
+#define SENDING_SLOT_STACK_SIZE     (THREAD_STACKSIZE_MINIMUM + 256)
 
 typedef struct {
     /* Sender state */
diff --git a/sys/net/network_layer/sixlowpan/ip.h b/sys/net/network_layer/sixlowpan/ip.h
index eddf12aa82..f421fbc24c 100644
--- a/sys/net/network_layer/sixlowpan/ip.h
+++ b/sys/net/network_layer/sixlowpan/ip.h
@@ -26,6 +26,7 @@
 #include <stdint.h>
 
 #include "kernel.h"
+#include "thread.h"
 #include "timex.h"
 #include "mutex.h"
 #include "net_if.h"
@@ -45,7 +46,7 @@ extern "C" {
 #define MULTIHOP_HOPLIMIT           (64)
 
 #define SIXLOWIP_MAX_REGISTERED     (4)
-#define IP_PROCESS_STACKSIZE        (KERNEL_CONF_STACKSIZE_MAIN)
+#define IP_PROCESS_STACKSIZE        (THREAD_STACKSIZE_MAIN)
 
 /* extern variables */
 extern uint8_t ipv6_ext_hdr_len;
diff --git a/sys/net/network_layer/sixlowpan/lowpan.c b/sys/net/network_layer/sixlowpan/lowpan.c
index 8ef6d943e8..a8aa511ead 100644
--- a/sys/net/network_layer/sixlowpan/lowpan.c
+++ b/sys/net/network_layer/sixlowpan/lowpan.c
@@ -52,8 +52,8 @@ static char addr_str[IPV6_MAX_ADDR_STR_LEN];
 #endif
 #include "debug.h"
 
-#define CON_STACKSIZE                   (KERNEL_CONF_STACKSIZE_DEFAULT)
-#define LOWPAN_TRANSFER_BUF_STACKSIZE   (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define CON_STACKSIZE                   (THREAD_STACKSIZE_DEFAULT)
+#define LOWPAN_TRANSFER_BUF_STACKSIZE   (THREAD_STACKSIZE_DEFAULT)
 
 #define SIXLOWPAN_MAX_REGISTERED        (4)
 
@@ -1748,7 +1748,7 @@ int sixlowpan_lowpan_init(void)
 
     if (ip_process_pid == KERNEL_PID_UNDEF) {
         ip_process_pid = thread_create(ip_process_buf, IP_PROCESS_STACKSIZE,
-                                       PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                       THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                        ipv6_process, NULL, "ip_process");
     }
 
@@ -1759,7 +1759,7 @@ int sixlowpan_lowpan_init(void)
     nbr_cache_auto_rem();
 
     contexts_rem_pid = thread_create(con_buf, CON_STACKSIZE,
-                                     PRIORITY_MAIN + 1, CREATE_STACKTEST,
+                                     THREAD_PRIORITY_MAIN + 1, CREATE_STACKTEST,
                                      lowpan_context_auto_remove, NULL, "lowpan_context_rem");
 
     if (contexts_rem_pid == KERNEL_PID_UNDEF) {
@@ -1767,7 +1767,7 @@ int sixlowpan_lowpan_init(void)
     }
 
     transfer_pid = thread_create(lowpan_transfer_buf, LOWPAN_TRANSFER_BUF_STACKSIZE,
-                                 PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                 THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                  lowpan_transfer, NULL, "lowpan_transfer");
 
     if (transfer_pid == KERNEL_PID_UNDEF) {
diff --git a/sys/net/network_layer/sixlowpan/mac.c b/sys/net/network_layer/sixlowpan/mac.c
index 822c3f49fc..16cdf24627 100644
--- a/sys/net/network_layer/sixlowpan/mac.c
+++ b/sys/net/network_layer/sixlowpan/mac.c
@@ -39,7 +39,7 @@
 #define ENABLE_DEBUG    (0)
 #include "debug.h"
 
-#define RADIO_STACK_SIZE            (KERNEL_CONF_STACKSIZE_MAIN)
+#define RADIO_STACK_SIZE            (THREAD_STACKSIZE_MAIN)
 #define RADIO_RCV_BUF_SIZE          (64)
 #define RADIO_SENDING_DELAY         (1000)
 
@@ -326,7 +326,7 @@ int sixlowpan_mac_send_ieee802154_frame(int if_id,
 kernel_pid_t sixlowpan_mac_init(void)
 {
     kernel_pid_t recv_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE,
-                                          PRIORITY_MAIN - 2, CREATE_STACKTEST,
+                                          THREAD_PRIORITY_MAIN - 2, CREATE_STACKTEST,
                                           recv_ieee802154_frame, NULL, "radio");
     int if_id = -1;
 
diff --git a/sys/net/routing/aodvv2/aodv.c b/sys/net/routing/aodvv2/aodv.c
index 939e5e09de..d6d502ffc2 100644
--- a/sys/net/routing/aodvv2/aodv.c
+++ b/sys/net/routing/aodvv2/aodv.c
@@ -41,8 +41,8 @@ char addr_str[IPV6_MAX_ADDR_STR_LEN];
 static struct netaddr_str nbuf;
 #endif
 
-static char aodv_rcv_stack_buf[KERNEL_CONF_STACKSIZE_MAIN];
-static char aodv_snd_stack_buf[KERNEL_CONF_STACKSIZE_MAIN];
+static char aodv_rcv_stack_buf[THREAD_STACKSIZE_MAIN];
+static char aodv_snd_stack_buf[THREAD_STACKSIZE_MAIN];
 
 static aodvv2_metric_t _metric_type;
 static int sender_thread;
@@ -89,11 +89,11 @@ void aodv_init(void)
     aodv_packet_writer_init(_write_packet);
 
     /* start listening & enable sending */
-    thread_create(aodv_rcv_stack_buf, sizeof(aodv_rcv_stack_buf), PRIORITY_MAIN,
+    thread_create(aodv_rcv_stack_buf, sizeof(aodv_rcv_stack_buf), THREAD_PRIORITY_MAIN,
                   CREATE_STACKTEST, _aodv_receiver_thread, NULL, "_aodv_receiver_thread");
     AODV_DEBUG("listening on port %d\n", HTONS(MANET_PORT));
     sender_thread = thread_create(aodv_snd_stack_buf, sizeof(aodv_snd_stack_buf),
-                                  PRIORITY_MAIN, CREATE_STACKTEST, _aodv_sender_thread,
+                                  THREAD_PRIORITY_MAIN, CREATE_STACKTEST, _aodv_sender_thread,
                                   NULL, "_aodv_sender_thread");
 
     /* register aodv for routing */
diff --git a/sys/net/routing/etx_beaconing.c b/sys/net/routing/etx_beaconing.c
index c22fa48441..836e1d120e 100644
--- a/sys/net/routing/etx_beaconing.c
+++ b/sys/net/routing/etx_beaconing.c
@@ -38,13 +38,13 @@
 #include "debug.h"
 
 #if ENABLE_DEBUG
-#define ETX_BEACON_STACKSIZE    (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF_FLOAT)
-#define ETX_RADIO_STACKSIZE     (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF_FLOAT)
-#define ETX_CLOCK_STACKSIZE     (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define ETX_BEACON_STACKSIZE    (THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT)
+#define ETX_RADIO_STACKSIZE     (THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT)
+#define ETX_CLOCK_STACKSIZE     (THREAD_STACKSIZE_DEFAULT)
 #else
-#define ETX_BEACON_STACKSIZE    (KERNEL_CONF_STACKSIZE_MAIN)
-#define ETX_RADIO_STACKSIZE     (KERNEL_CONF_STACKSIZE_MAIN)
-#define ETX_CLOCK_STACKSIZE     (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define ETX_BEACON_STACKSIZE    (THREAD_STACKSIZE_MAIN)
+#define ETX_RADIO_STACKSIZE     (THREAD_STACKSIZE_MAIN)
+#define ETX_CLOCK_STACKSIZE     (THREAD_STACKSIZE_DEFAULT)
 #endif
 
 /* prototytpes */
@@ -148,15 +148,15 @@ void etx_init_beaconing(ipv6_addr_t *address)
     etx_send_buf[0] = ETX_PKT_OPTVAL;
 
     etx_beacon_pid = thread_create(etx_beacon_buf, sizeof(etx_beacon_buf),
-                                   PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                   THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                    etx_beacon, NULL, "etx_beacon");
 
     etx_radio_pid = thread_create(etx_radio_buf, sizeof(etx_radio_buf),
-                                  PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                  THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                   etx_radio, NULL, "etx_radio");
 
     etx_clock_pid = thread_create(etx_clock_buf, sizeof(etx_clock_buf),
-                                  PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                  THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                   etx_clock, NULL, "etx_clock");
     //register at transceiver
     transceiver_register(TRANSCEIVER_CC1100, etx_radio_pid);
diff --git a/sys/net/routing/nhdp/nhdp.c b/sys/net/routing/nhdp/nhdp.c
index 086454550c..2e66fcb917 100644
--- a/sys/net/routing/nhdp/nhdp.c
+++ b/sys/net/routing/nhdp/nhdp.c
@@ -88,7 +88,7 @@ kernel_pid_t nhdp_start(void)
         sock_rcv = socket_base_socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
 
         /* Start the NHDP thread */
-        nhdp_pid = thread_create(nhdp_stack, sizeof(nhdp_stack), PRIORITY_MAIN - 1,
+        nhdp_pid = thread_create(nhdp_stack, sizeof(nhdp_stack), THREAD_PRIORITY_MAIN - 1,
                                  CREATE_STACKTEST, _nhdp_runner, NULL, "NHDP");
     }
 
@@ -179,7 +179,7 @@ int nhdp_register_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8
     helper_pid = if_pid;
 
     /* Start the receiving thread */
-    nhdp_rcv_pid = thread_create(nhdp_rcv_stack, sizeof(nhdp_rcv_stack), PRIORITY_MAIN - 1,
+    nhdp_rcv_pid = thread_create(nhdp_rcv_stack, sizeof(nhdp_rcv_stack), THREAD_PRIORITY_MAIN - 1,
                                  CREATE_STACKTEST, _nhdp_receiver, NULL, "nhdp_rcv_thread");
 
     /* Start sending periodic HELLO */
diff --git a/sys/net/routing/nhdp/nhdp.h b/sys/net/routing/nhdp/nhdp.h
index 46fd04e051..c3e54326e1 100644
--- a/sys/net/routing/nhdp/nhdp.h
+++ b/sys/net/routing/nhdp/nhdp.h
@@ -47,9 +47,9 @@ extern "C" {
 
 /** @brief Stack size for NHDP thread */
 #if ENABLE_DEBUG
-#define NHDP_STACK_SIZE      (KERNEL_CONF_STACKSIZE_DEFAULT + KERNEL_CONF_STACKSIZE_PRINTF)
+#define NHDP_STACK_SIZE      (THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF)
 #else
-#define NHDP_STACK_SIZE      (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define NHDP_STACK_SIZE      (THREAD_STACKSIZE_DEFAULT)
 #endif
 
 /** @brief Buffer size in bytes for NHDP writer's msg buffer */
diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c
index ad9a985b56..b30c91979a 100644
--- a/sys/net/routing/rpl/rpl.c
+++ b/sys/net/routing/rpl/rpl.c
@@ -83,7 +83,7 @@ uint8_t rpl_init(int if_id, ipv6_addr_t *address)
 #endif
 
     rpl_process_pid = thread_create(rpl_process_buf, sizeof(rpl_process_buf),
-                                    PRIORITY_MAIN - 1, CREATE_STACKTEST,
+                                    THREAD_PRIORITY_MAIN - 1, CREATE_STACKTEST,
                                     rpl_process, NULL, "rpl_process");
 
     sixlowpan_lowpan_init_interface(if_id);
diff --git a/sys/net/transport_layer/tcp/tcp.c b/sys/net/transport_layer/tcp/tcp.c
index 1b66661475..4555ac982f 100644
--- a/sys/net/transport_layer/tcp/tcp.c
+++ b/sys/net/transport_layer/tcp/tcp.c
@@ -1405,7 +1405,7 @@ int tcp_init_transport_layer(void)
     global_sequence_counter = rand();
 
     int tcp_thread_pid = thread_create(tcp_stack_buffer, TCP_STACK_SIZE,
-                                       PRIORITY_MAIN, CREATE_STACKTEST, tcp_packet_handler, NULL, "tcp_packet_handler");
+                                       THREAD_PRIORITY_MAIN, CREATE_STACKTEST, tcp_packet_handler, NULL, "tcp_packet_handler");
 
     if (tcp_thread_pid < 0) {
         return -1;
@@ -1413,7 +1413,7 @@ int tcp_init_transport_layer(void)
 
     ipv6_register_next_header_handler(IPV6_PROTO_NUM_TCP, tcp_thread_pid);
 
-    if (thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, PRIORITY_MAIN + 1,
+    if (thread_create(tcp_timer_stack, TCP_TIMER_STACKSIZE, THREAD_PRIORITY_MAIN + 1,
                       CREATE_STACKTEST, tcp_general_timer, NULL, "tcp_general_timer") < 0) {
         return -1;
     }
diff --git a/sys/net/transport_layer/tcp/tcp.h b/sys/net/transport_layer/tcp/tcp.h
index 6b72cba99e..a30b0c8d5b 100644
--- a/sys/net/transport_layer/tcp/tcp.h
+++ b/sys/net/transport_layer/tcp/tcp.h
@@ -85,7 +85,7 @@ enum tcp_codes {
 #define SET_TCP_FIN(a)          (a) = TCP_FIN
 #define SET_TCP_FIN_ACK(a)      (a) = TCP_FIN_ACK
 
-#define TCP_STACK_SIZE          (KERNEL_CONF_STACKSIZE_MAIN)
+#define TCP_STACK_SIZE          (THREAD_STACKSIZE_MAIN)
 
 typedef struct __attribute__((packed)) tcp_mms_o_t {
     uint8_t     kind;
diff --git a/sys/net/transport_layer/tcp/tcp_timer.h b/sys/net/transport_layer/tcp/tcp_timer.h
index 94709f92be..ff1d707e97 100644
--- a/sys/net/transport_layer/tcp/tcp_timer.h
+++ b/sys/net/transport_layer/tcp/tcp_timer.h
@@ -22,7 +22,7 @@ extern "C" {
 #define TCP_TIMER_RESOLUTION        500*1000
 
 #define SECOND                      1000.0f*1000.0f
-#define TCP_TIMER_STACKSIZE         KERNEL_CONF_STACKSIZE_DEFAULT
+#define TCP_TIMER_STACKSIZE         THREAD_STACKSIZE_DEFAULT
 #define TCP_SYN_INITIAL_TIMEOUT     6*SECOND
 #define TCP_SYN_TIMEOUT             24*SECOND
 #define TCP_MAX_SYN_RETRIES         3
diff --git a/sys/net/transport_layer/udp/udp.c b/sys/net/transport_layer/udp/udp.c
index 5dac8d4b40..6dc93f78c4 100644
--- a/sys/net/transport_layer/udp/udp.c
+++ b/sys/net/transport_layer/udp/udp.c
@@ -204,7 +204,7 @@ int udp_init_transport_layer(void)
     /* SOCKETS */
     memset(socket_base_sockets, 0, MAX_SOCKETS * sizeof(socket_internal_t));
 
-    int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE, PRIORITY_MAIN,
+    int udp_thread_pid = thread_create(udp_stack_buffer, UDP_STACK_SIZE, THREAD_PRIORITY_MAIN,
                                         CREATE_STACKTEST, udp_packet_handler, NULL, "udp_packet_handler");
 
     if (udp_thread_pid < 0) {
diff --git a/sys/net/transport_layer/udp/udp.h b/sys/net/transport_layer/udp/udp.h
index daa8cad338..52a9c4f94b 100644
--- a/sys/net/transport_layer/udp/udp.h
+++ b/sys/net/transport_layer/udp/udp.h
@@ -32,7 +32,7 @@ extern "C" {
 /**
  * @brief   Stack size used for the UDP thread
  */
-#define UDP_STACK_SIZE                  KERNEL_CONF_STACKSIZE_MAIN
+#define UDP_STACK_SIZE                  THREAD_STACKSIZE_MAIN
 
 /**
  * @brief   Size of the UDP receive buffer
diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c
index 761bc75aaf..538b243bbb 100644
--- a/sys/posix/pthread/pthread.c
+++ b/sys/posix/pthread/pthread.c
@@ -38,11 +38,11 @@
 #define ENABLE_DEBUG (0)
 
 #if ENABLE_DEBUG
-#   define PTHREAD_REAPER_STACKSIZE KERNEL_CONF_STACKSIZE_MAIN
-#   define PTHREAD_STACKSIZE KERNEL_CONF_STACKSIZE_MAIN
+#   define PTHREAD_REAPER_STACKSIZE THREAD_STACKSIZE_MAIN
+#   define PTHREAD_STACKSIZE THREAD_STACKSIZE_MAIN
 #else
-#   define PTHREAD_REAPER_STACKSIZE KERNEL_CONF_STACKSIZE_DEFAULT
-#   define PTHREAD_STACKSIZE KERNEL_CONF_STACKSIZE_DEFAULT
+#   define PTHREAD_REAPER_STACKSIZE THREAD_STACKSIZE_DEFAULT
+#   define PTHREAD_STACKSIZE THREAD_STACKSIZE_DEFAULT
 #endif
 
 #include "debug.h"
@@ -154,7 +154,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
 
     pt->thread_pid = thread_create(stack,
                                    stack_size,
-                                   PRIORITY_MAIN,
+                                   THREAD_PRIORITY_MAIN,
                                    CREATE_WOUT_YIELD | CREATE_STACKTEST,
                                    pthread_start_routine,
                                    pt,
@@ -166,7 +166,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
         return -1;
     }
 
-    sched_switch(PRIORITY_MAIN);
+    sched_switch(THREAD_PRIORITY_MAIN);
 
     return 0;
 }
diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c
index a3e6f07ff4..a0a89a7a60 100644
--- a/sys/transceiver/transceiver.c
+++ b/sys/transceiver/transceiver.c
@@ -67,7 +67,7 @@
 #define ENABLE_DEBUG (0)
 #if ENABLE_DEBUG
 #undef TRANSCEIVER_STACK_SIZE
-#define TRANSCEIVER_STACK_SIZE      (KERNEL_CONF_STACKSIZE_MAIN)
+#define TRANSCEIVER_STACK_SIZE      (THREAD_STACKSIZE_MAIN)
 #endif
 #include "debug.h"
 
@@ -186,7 +186,7 @@ void transceiver_init(transceiver_type_t t)
 /* Start the transceiver thread */
 kernel_pid_t transceiver_start(void)
 {
-    transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver");
+    transceiver_pid = thread_create(transceiver_stack, TRANSCEIVER_STACK_SIZE, THREAD_PRIORITY_MAIN - 3, CREATE_STACKTEST, run, NULL, "Transceiver");
 
     if (transceiver_pid == KERNEL_PID_UNDEF) {
         puts("Error creating transceiver thread");
diff --git a/sys/uart0/uart0.c b/sys/uart0/uart0.c
index 7adb0d2e06..1a8d1e9f6f 100644
--- a/sys/uart0/uart0.c
+++ b/sys/uart0/uart0.c
@@ -36,7 +36,7 @@
 #endif
 
 /* increase when ENABLE_DEBUG in chardev_thread is set to 1! */
-#define UART0_STACKSIZE     (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define UART0_STACKSIZE     (THREAD_STACKSIZE_DEFAULT)
 
 ringbuffer_t uart0_ringbuffer;
 kernel_pid_t uart0_handler_pid = KERNEL_PID_UNDEF;
@@ -51,7 +51,7 @@ void board_uart0_init(void)
     kernel_pid_t pid = thread_create(
                   uart0_thread_stack,
                   sizeof(uart0_thread_stack),
-                  PRIORITY_MAIN - 1,
+                  THREAD_PRIORITY_MAIN - 1,
                   CREATE_STACKTEST | CREATE_SLEEPING,
                   chardev_thread_entry,
                   &uart0_ringbuffer,
diff --git a/tests/driver_at86rf2xx/auto_init_ng_netif/netif_app.c b/tests/driver_at86rf2xx/auto_init_ng_netif/netif_app.c
new file mode 100644
index 0000000000..ac1d3a7ad4
--- /dev/null
+++ b/tests/driver_at86rf2xx/auto_init_ng_netif/netif_app.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2015 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     tests
+ * @{
+ *
+ * @file
+ * @brief       Test application for AT86RF2xx network device driver
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ *
+ * @}
+ */
+
+#include <stdio.h>
+
+#include "kernel.h"
+#include "ng_at86rf2xx.h"
+#include "net/ng_nomac.h"
+#include "net/ng_netbase.h"
+
+/* make sure the SPI port and the needed GPIO pins are defined */
+#ifndef ATRF_SPI
+#error "SPI not defined"
+#endif
+#ifndef ATRF_CS
+#error "Chip select pin not defined"
+#endif
+#ifndef ATRF_INT
+#error "Interrupt pin not defined"
+#endif
+#ifndef ATRF_SLEEP
+#error "Sleep pin not defined"
+#endif
+#ifndef ATRF_RESET
+#error "Reset pin not defined"
+#endif
+#ifndef ATRF_SPI_SPEED
+#define ATRF_SPI_SPEED          (SPI_SPEED_5MHZ)
+#endif
+
+/**
+ * @brief   MAC layer stack configuration
+ * @{
+ */
+#define STACKSIZE               (THREAD_STACKSIZE_MAIN)
+#define PRIO                    (0)
+/** @} */
+
+/**
+ * @brief   Allocate the AT86RF2xx device descriptor
+ */
+static ng_at86rf2xx_t dev;
+
+/**
+ * @brief   Stack for the nomac thread
+ */
+static char nomac_stack[STACKSIZE];
+
+
+void auto_init_ng_netif(void)
+{
+    kernel_pid_t iface;
+    int res;
+
+    /* initialize the AT86RF2xx device */
+    printf("Initializing the AT86RF2xx radio at SPI_%i... \n", ATRF_SPI);
+    res = ng_at86rf2xx_init(&dev, ATRF_SPI, ATRF_SPI_SPEED,
+                            ATRF_CS, ATRF_INT,
+                            ATRF_SLEEP, ATRF_RESET);
+    if (res < 0) {
+        puts("Error initializing AT86RF2xx radio device");
+        return;
+    }
+
+    /* start MAC layer */
+    puts("Starting the NOMAC layer on top of the driver");
+    iface = ng_nomac_init(nomac_stack, sizeof(nomac_stack), PRIO, "at86rf2xx",
+                          (ng_netdev_t *)(&dev));
+    if (iface <= KERNEL_PID_UNDEF) {
+        puts("Error initializing MAC layer");
+        return;
+    }
+
+}
diff --git a/tests/driver_kw2xrf/auto_init_ng_netif/netif_app.c b/tests/driver_kw2xrf/auto_init_ng_netif/netif_app.c
new file mode 100644
index 0000000000..ae54951c2f
--- /dev/null
+++ b/tests/driver_kw2xrf/auto_init_ng_netif/netif_app.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 Freie Universität Berlin
+ * Copyright (C) 2015 PHYTEC Messtechnik GmbH
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     tests
+ * @{
+ *
+ * @file
+ * @brief       Test application for KW2xRF network device driver
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ * @author      Jonas Remmert <j.remmert@phytec.de>
+ *
+ * @}
+ */
+
+#include <stdio.h>
+
+#include "kernel.h"
+#include "kw2xrf.h"
+#include "net/ng_nomac.h"
+#include "net/ng_netbase.h"
+
+/* make sure the SPI port and the needed GPIO pins are defined */
+#ifndef KWRF_SPI
+#error "SPI not defined"
+#endif
+#ifndef KWRF_CS
+#error "Chip select pin not defined"
+#endif
+#ifndef KWRF_INT
+#error "Interrupt pin not defined"
+#endif
+#ifndef KWRF_SPI_SPEED
+#define KWRF_SPI_SPEED          (SPI_SPEED_10MHZ)
+#endif
+
+/**
+ * @brief   MAC layer stack configuration
+ * @{
+ */
+#define STACKSIZE               (THREAD_STACKSIZE_MAIN)
+#define PRIO                    (0)
+/** @} */
+
+/**
+ * @brief   Allocate the KW2XRF device descriptor
+ */
+static kw2xrf_t dev;
+
+/**
+ * @brief   Stack for the nomac thread
+ */
+static char nomac_stack[STACKSIZE];
+
+
+void auto_init_ng_netif(void)
+{
+    kernel_pid_t iface;
+    int res;
+
+    /* initialize the KW2XRF device */
+    printf("Initializing the KW2XRF radio at SPI_%i... \n", KWRF_SPI);
+    res = kw2xrf_init(&dev, KWRF_SPI, KWRF_SPI_SPEED,
+                            KWRF_CS, KWRF_INT);
+    if (res < 0) {
+        puts("Error initializing KW2XRF radio device");
+        return;
+    }
+
+    /* start MAC layer */
+    puts("Starting the NOMAC layer on top of the driver");
+    iface = ng_nomac_init(nomac_stack, sizeof(nomac_stack), PRIO, "kw2xrf",
+                          (ng_netdev_t *)(&dev));
+    if (iface <= KERNEL_PID_UNDEF) {
+        puts("Error initializing MAC layer");
+        return;
+    }
+
+}
diff --git a/tests/driver_nrf24l01p_lowlevel/main.c b/tests/driver_nrf24l01p_lowlevel/main.c
index 4ebdd50e34..59c577bdea 100644
--- a/tests/driver_nrf24l01p_lowlevel/main.c
+++ b/tests/driver_nrf24l01p_lowlevel/main.c
@@ -125,7 +125,7 @@ void print_register(char reg, int num_bytes)
     }
 }
 
-char rx_handler_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char rx_handler_stack[THREAD_STACKSIZE_MAIN];
 
 /* RX handler that waits for a message from the ISR */
 void *nrf24l01p_rx_handler(void *arg)
@@ -197,7 +197,7 @@ int cmd_its(int argc, char **argv)
 
     /* create thread that gets msg when data arrives */
     if (thread_create(
-        rx_handler_stack, sizeof(rx_handler_stack), PRIORITY_MAIN - 1, 0,
+        rx_handler_stack, sizeof(rx_handler_stack), THREAD_PRIORITY_MAIN - 1, 0,
         nrf24l01p_rx_handler, 0, "nrf24l01p_rx_handler") < 0) {
         puts("Error in thread_create");
         return;
diff --git a/tests/driver_pir/main.c b/tests/driver_pir/main.c
index 0d80931ebf..4932ebe872 100644
--- a/tests/driver_pir/main.c
+++ b/tests/driver_pir/main.c
@@ -28,7 +28,7 @@
 #include "vtimer.h"
 #include "pir.h"
 
-char pir_handler_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char pir_handler_stack[THREAD_STACKSIZE_MAIN];
 pir_t dev;
 
 void* pir_handler(void *arg)
@@ -79,7 +79,7 @@ int main(void)
     }
 #else
    thread_create(
-           pir_handler_stack, sizeof(pir_handler_stack), PRIORITY_MAIN - 1,
+           pir_handler_stack, sizeof(pir_handler_stack), THREAD_PRIORITY_MAIN - 1,
            CREATE_WOUT_YIELD | CREATE_STACKTEST,
            pir_handler, NULL, "pir_handler");
 #endif
diff --git a/tests/driver_xbee/auto_init_ng_netif/netif_app.c b/tests/driver_xbee/auto_init_ng_netif/netif_app.c
new file mode 100644
index 0000000000..90cf1bfade
--- /dev/null
+++ b/tests/driver_xbee/auto_init_ng_netif/netif_app.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2015 Freie Universität Berlin
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     tests
+ * @{
+ *
+ * @file
+ * @brief       Xbee device initialization
+ *
+ * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
+ *
+ * @}
+ */
+
+#include <stdio.h>
+
+#include "kernel.h"
+#include "xbee.h"
+#include "net/ng_nomac.h"
+#include "net/ng_netbase.h"
+
+/* make sure an UART to device is defined in the Makefile */
+#ifndef XBEE_UART
+#error "XBEE_UART not defined"
+#endif
+
+/**
+ * @brief   This is the default baudrate the Xbee modules are programmed to
+ *          when you buy them
+ */
+#define XBEE_BAUDRATE           (9600U)
+
+/**
+ * @brief   MAC layer stack configuration
+ * @{
+ */
+#define STACKSIZE               (THREAD_STACKSIZE_DEFAULT)
+#define PRIO                    (0)
+/** @} */
+
+/**
+ * @brief   The Xbee device descriptor
+ */
+static xbee_t dev;
+
+/**
+ * @brief   Stack for the nomac thread
+ */
+static char nomac_stack[STACKSIZE];
+
+
+void auto_init_ng_netif(void)
+{
+    int res;
+    kernel_pid_t iface;
+
+    /* setup Xbee device */
+    printf("Initializing the Xbee S1 device UART_%i... \n", XBEE_UART);
+    res = xbee_init(&dev, XBEE_UART, XBEE_BAUDRATE, GPIO_NUMOF, GPIO_NUMOF);
+    if (res < 0) {
+        puts("Error initializing xbee device driver");
+        return;
+    }
+    /* start MAC layer */
+    iface = ng_nomac_init(nomac_stack, sizeof(nomac_stack), PRIO, "xbee",
+                          (ng_netdev_t *)(&dev));
+    if (iface <= KERNEL_PID_UNDEF) {
+        puts("Error initializing MAC layer");
+        return;
+    }
+}
diff --git a/tests/irq/main.c b/tests/irq/main.c
index 8735f89a0d..9139c1ea56 100644
--- a/tests/irq/main.c
+++ b/tests/irq/main.c
@@ -23,7 +23,7 @@
 #include "hwtimer.h"
 #include "thread.h"
 
-char busy_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char busy_stack[THREAD_STACKSIZE_MAIN];
 volatile int busy, i, k;
 
 void *busy_thread(void *arg)
@@ -54,7 +54,7 @@ int main(void)
     busy = 1;
     k = 23;
     thread_create(busy_stack, sizeof(busy_stack),
-                  PRIORITY_MAIN + 1, CREATE_WOUT_YIELD,
+                  THREAD_PRIORITY_MAIN + 1, CREATE_WOUT_YIELD,
                   busy_thread, NULL, "busy_thread");
     puts("busy_thread created");
 
diff --git a/tests/msg_send_receive/main.c b/tests/msg_send_receive/main.c
index 9262fef374..6ba74d73cb 100644
--- a/tests/msg_send_receive/main.c
+++ b/tests/msg_send_receive/main.c
@@ -24,8 +24,8 @@
 #include "cpu-conf.h"
 #include "thread.h"
 
-#define THREAD1_STACKSIZE   (KERNEL_CONF_STACKSIZE_PRINTF)
-#define THREAD2_STACKSIZE   (KERNEL_CONF_STACKSIZE_PRINTF)
+#define THREAD1_STACKSIZE   (THREAD_EXTRA_STACKSIZE_PRINTF)
+#define THREAD2_STACKSIZE   (THREAD_EXTRA_STACKSIZE_PRINTF)
 
 #ifndef TEST_EXECUTION_NUM
 #define TEST_EXECUTION_NUM  (10)
@@ -93,9 +93,9 @@ static void *thread2(void *args)
 
 int main(void)
 {
-    thread2_pid = thread_create(thread2_stack, THREAD2_STACKSIZE, PRIORITY_MAIN - 1,
+    thread2_pid = thread_create(thread2_stack, THREAD2_STACKSIZE, THREAD_PRIORITY_MAIN - 1,
                                 0, thread2, NULL, "thread2");
-    thread1_pid = thread_create(thread1_stack, THREAD1_STACKSIZE, PRIORITY_MAIN - 2,
+    thread1_pid = thread_create(thread1_stack, THREAD1_STACKSIZE, THREAD_PRIORITY_MAIN - 2,
                                 0, thread1, NULL, "thread1");
     return 0;
 }
diff --git a/tests/mutex_unlock_and_sleep/main.c b/tests/mutex_unlock_and_sleep/main.c
index 8bc26bbe3f..95ff54bc1a 100644
--- a/tests/mutex_unlock_and_sleep/main.c
+++ b/tests/mutex_unlock_and_sleep/main.c
@@ -26,7 +26,7 @@ static mutex_t mutex = MUTEX_INIT;
 static volatile int indicator, count;
 static kernel_pid_t main_pid;
 
-static char stack[KERNEL_CONF_STACKSIZE_MAIN];
+static char stack[THREAD_STACKSIZE_MAIN];
 static void *second_thread(void *arg)
 {
     (void) arg;
@@ -48,7 +48,7 @@ int main(void)
 
     kernel_pid_t second_pid = thread_create(stack,
                   sizeof(stack),
-                  PRIORITY_MAIN - 1,
+                  THREAD_PRIORITY_MAIN - 1,
                   CREATE_WOUT_YIELD | CREATE_STACKTEST,
                   second_thread,
                   NULL,
diff --git a/tests/nativenet/main.c b/tests/nativenet/main.c
index 6c76ee5a02..c7d157a59e 100644
--- a/tests/nativenet/main.c
+++ b/tests/nativenet/main.c
@@ -39,7 +39,7 @@
 #define SENDING_DELAY       (10 * 1000)
 
 #define RCV_BUFFER_SIZE     (64)
-#define RADIO_STACK_SIZE    (KERNEL_CONF_STACKSIZE_DEFAULT)
+#define RADIO_STACK_SIZE    (THREAD_STACKSIZE_DEFAULT)
 
 static char radio_stack_buffer[RADIO_STACK_SIZE];
 static msg_t msg_q[RCV_BUFFER_SIZE];
@@ -145,7 +145,7 @@ int main(void)
     printf("\n\tmain(): starting radio thread\n");
     kernel_pid_t radio_pid = thread_create(
             radio_stack_buffer, sizeof(radio_stack_buffer),
-            PRIORITY_MAIN - 2, CREATE_STACKTEST,
+            THREAD_PRIORITY_MAIN - 2, CREATE_STACKTEST,
             radio, NULL, "radio");
     transceiver_register(TRANSCEIVER_NATIVE, radio_pid);
 #endif
diff --git a/tests/periph_uart_int/main.c b/tests/periph_uart_int/main.c
index 8e5015705b..3fb22cb86c 100644
--- a/tests/periph_uart_int/main.c
+++ b/tests/periph_uart_int/main.c
@@ -47,7 +47,7 @@
 
 static volatile int main_pid;
 
-static char uart_stack[KERNEL_CONF_STACKSIZE_MAIN];
+static char uart_stack[THREAD_STACKSIZE_MAIN];
 
 static char rx_mem[128];
 static char tx_mem[128];
@@ -111,7 +111,7 @@ int main(void)
     }
 
     puts("Starting timer thread that triggers UART output...");
-    thread_create(uart_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
+    thread_create(uart_stack, THREAD_STACKSIZE_MAIN, THREAD_PRIORITY_MAIN - 1,
                   0, uart_thread, 0, "uart");
 
     while (1) {
diff --git a/tests/pipe/main.c b/tests/pipe/main.c
index 401e7f6ae9..f1edc2a20d 100644
--- a/tests/pipe/main.c
+++ b/tests/pipe/main.c
@@ -36,7 +36,7 @@
 
 #define BYTES_TOTAL (26)
 
-static char stacks[2][KERNEL_CONF_STACKSIZE_MAIN];
+static char stacks[2][THREAD_STACKSIZE_MAIN];
 
 static char pipe_bufs[2][6];
 static ringbuffer_t rbs[2];
@@ -101,10 +101,10 @@ int main(void)
     }
 
     thread_create(stacks[0], sizeof (stacks[0]),
-                  PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST,
+                  THREAD_PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST,
                   run_middle, NULL, "middle");
     thread_create(stacks[1], sizeof (stacks[1]),
-                  PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST,
+                  THREAD_PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST,
                   run_end, NULL, "end");
 
     unsigned total = 0;
diff --git a/tests/posix_semaphore/main.c b/tests/posix_semaphore/main.c
index 8e69777c9f..c6258511a3 100644
--- a/tests/posix_semaphore/main.c
+++ b/tests/posix_semaphore/main.c
@@ -26,8 +26,8 @@
 #include "semaphore.h"
 
 #define SEMAPHORE_TEST_THREADS 5
-char test1_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char test2_thread_stack[SEMAPHORE_TEST_THREADS][KERNEL_CONF_STACKSIZE_MAIN];
+char test1_thread_stack[THREAD_STACKSIZE_MAIN];
+char test2_thread_stack[SEMAPHORE_TEST_THREADS][THREAD_STACKSIZE_MAIN];
 
 sem_t s;
 
@@ -65,7 +65,7 @@ static void test1(void)
     puts("first: thread create");
     kernel_pid_t pid = thread_create(test1_thread_stack,
                                      sizeof(test1_thread_stack),
-                                     PRIORITY_MAIN - 1,
+                                     THREAD_PRIORITY_MAIN - 1,
                                      CREATE_STACKTEST | CREATE_WOUT_YIELD,
                                      test1_second_thread,
                                      NULL,
@@ -134,7 +134,7 @@ void test2(void)
     }
 
     for (int i = 0; i < SEMAPHORE_TEST_THREADS; i++) {
-        int priority = PRIORITY_MAIN - (i + 3) % 10 + 1;
+        int priority = THREAD_PRIORITY_MAIN - (i + 3) % 10 + 1;
 
         snprintf(names[i], sizeof(names[i]), "priority %d", priority);
         printf("first: thread create: %d\n", priority);
diff --git a/tests/pthread_condition_variable/main.c b/tests/pthread_condition_variable/main.c
index 29eceaec69..faa057afb1 100644
--- a/tests/pthread_condition_variable/main.c
+++ b/tests/pthread_condition_variable/main.c
@@ -27,7 +27,7 @@ static struct pthread_cond_t cv;
 static volatile int is_finished;
 static volatile long count;
 static volatile long expected_value;
-static char stack[KERNEL_CONF_STACKSIZE_MAIN];
+static char stack[THREAD_STACKSIZE_MAIN];
 
 /**
  * @brief   This thread tries to lock the mutex to enter the critical section.
@@ -57,7 +57,7 @@ int main(void)
     expected_value = 1000*1000;
     pthread_cond_init(&cv, NULL);
 
-    kernel_pid_t pid = thread_create(stack,sizeof(stack), PRIORITY_MAIN - 1,
+    kernel_pid_t pid = thread_create(stack,sizeof(stack), THREAD_PRIORITY_MAIN - 1,
                                      CREATE_WOUT_YIELD | CREATE_STACKTEST,
                                      second_thread, NULL, "second_thread");
 
diff --git a/tests/pthread_rwlock/main.c b/tests/pthread_rwlock/main.c
index d96e1116d4..39045b9c67 100644
--- a/tests/pthread_rwlock/main.c
+++ b/tests/pthread_rwlock/main.c
@@ -97,7 +97,7 @@ static void *reader(void *arg)
 
 int main(void)
 {
-    static char stacks[NUM_CHILDREN][KERNEL_CONF_STACKSIZE_MAIN];
+    static char stacks[NUM_CHILDREN][THREAD_STACKSIZE_MAIN];
 
     puts("Main start.");
 
@@ -108,20 +108,20 @@ int main(void)
 
         if (i < NUM_READERS) {
             if (i < NUM_READERS_HIGH) {
-                prio = PRIORITY_MAIN + 1;
+                prio = THREAD_PRIORITY_MAIN + 1;
             }
             else {
-                prio = PRIORITY_MAIN + 2;
+                prio = THREAD_PRIORITY_MAIN + 2;
             }
             fun = reader;
             name = "reader";
         }
         else {
             if (i - NUM_READERS < NUM_WRITERS_HIGH) {
-                prio = PRIORITY_MAIN + 1;
+                prio = THREAD_PRIORITY_MAIN + 1;
             }
             else {
-                prio = PRIORITY_MAIN + 2;
+                prio = THREAD_PRIORITY_MAIN + 2;
             }
             fun = writer;
             name = "writer";
diff --git a/tests/sched_testing/main.c b/tests/sched_testing/main.c
index bd21d2a3b1..3b8edf64c6 100644
--- a/tests/sched_testing/main.c
+++ b/tests/sched_testing/main.c
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include "thread.h"
 
-char snd_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char snd_thread_stack[THREAD_STACKSIZE_MAIN];
 
 void *snd_thread(void *unused)
 {
@@ -33,7 +33,7 @@ int main(void)
     puts("The output should be: yield 1, snd_thread running, yield 2, done");
     puts("----------------------------------------------------------------");
 
-    thread_create(snd_thread_stack, sizeof(snd_thread_stack), PRIORITY_MAIN,
+    thread_create(snd_thread_stack, sizeof(snd_thread_stack), THREAD_PRIORITY_MAIN,
                   CREATE_WOUT_YIELD, snd_thread, NULL, "snd");
 
     puts("yield 1");
diff --git a/tests/thread_basic/main.c b/tests/thread_basic/main.c
index 819a54ea91..a8fb8e3a72 100644
--- a/tests/thread_basic/main.c
+++ b/tests/thread_basic/main.c
@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include "thread.h"
 
-char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char t2_stack[THREAD_STACKSIZE_MAIN];
 
 void *second_thread(void *arg)
 {
@@ -34,7 +34,7 @@ int main(void)
 {
     (void) thread_create(
             t2_stack, sizeof(t2_stack),
-            PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
+            THREAD_PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
             second_thread, NULL, "nr2");
     puts("first thread\n");
     return 0;
diff --git a/tests/thread_cooperation/main.c b/tests/thread_cooperation/main.c
index e3bb35c020..6ef2291c2a 100644
--- a/tests/thread_cooperation/main.c
+++ b/tests/thread_cooperation/main.c
@@ -31,7 +31,7 @@ mutex_t mtx = MUTEX_INIT;
 volatile int storage = 1;
 kernel_pid_t main_id = KERNEL_PID_UNDEF;
 kernel_pid_t ths[PROBLEM];
-char stacks[PROBLEM][KERNEL_CONF_STACKSIZE_MAIN];
+char stacks[PROBLEM][THREAD_STACKSIZE_MAIN];
 
 void *run(void *arg)
 {
@@ -70,7 +70,7 @@ int main(void)
     for (int i = 0; i < PROBLEM; ++i) {
         printf("Creating thread with arg %d\n", (i + 1));
         ths[i] = thread_create(stacks[i], sizeof(stacks[i]),
-                               PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
+                               THREAD_PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
                                run, NULL, "thread");
 
         if (ths[i] < 0)  {
diff --git a/tests/thread_exit/main.c b/tests/thread_exit/main.c
index 925afd0e56..6d214b10c3 100644
--- a/tests/thread_exit/main.c
+++ b/tests/thread_exit/main.c
@@ -22,8 +22,8 @@
 
 #include "thread.h"
 
-char second_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char third_thread_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char second_thread_stack[THREAD_STACKSIZE_MAIN];
+char third_thread_stack[THREAD_STACKSIZE_MAIN];
 
 void *fourth_thread(void *arg)
 {
@@ -49,7 +49,7 @@ void *second_thread(void *arg)
     if ((thread_create(
              third_thread_stack,
              sizeof(third_thread_stack),
-             PRIORITY_MAIN - 2,
+             THREAD_PRIORITY_MAIN - 2,
              CREATE_STACKTEST,
              third_thread,
              NULL,
@@ -63,7 +63,7 @@ void *second_thread(void *arg)
     if ((thread_create(
              third_thread_stack,
              sizeof(third_thread_stack),
-             PRIORITY_MAIN - 1,
+             THREAD_PRIORITY_MAIN - 1,
              CREATE_WOUT_YIELD | CREATE_STACKTEST,
              fourth_thread,
              NULL,
@@ -83,7 +83,7 @@ int main(void)
     if ((thread_create(
              second_thread_stack,
              sizeof(second_thread_stack),
-             PRIORITY_MAIN - 1,
+             THREAD_PRIORITY_MAIN - 1,
              CREATE_WOUT_YIELD | CREATE_STACKTEST,
              second_thread,
              NULL,
diff --git a/tests/thread_msg/main.c b/tests/thread_msg/main.c
index a2aebdfceb..6b85f2e638 100644
--- a/tests/thread_msg/main.c
+++ b/tests/thread_msg/main.c
@@ -24,9 +24,9 @@
 #include "thread.h"
 #include "msg.h"
 
-char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char t3_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char t1_stack[THREAD_STACKSIZE_MAIN];
+char t2_stack[THREAD_STACKSIZE_MAIN];
+char t3_stack[THREAD_STACKSIZE_MAIN];
 
 kernel_pid_t p1, p2, p3;
 
@@ -83,13 +83,13 @@ void *thread3(void *arg)
 
 int main(void)
 {
-    p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
+    p1 = thread_create(t1_stack, sizeof(t1_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        thread1, NULL, "nr1");
-    p2 = thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN - 1,
+    p2 = thread_create(t2_stack, sizeof(t2_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        thread2, NULL, "nr2");
-    p3 = thread_create(t3_stack, sizeof(t3_stack), PRIORITY_MAIN - 1,
+    p3 = thread_create(t3_stack, sizeof(t3_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        thread3, NULL, "nr3");
     puts("THREADS CREATED\n");
diff --git a/tests/thread_msg_block_w_queue/main.c b/tests/thread_msg_block_w_queue/main.c
index 24df29838d..f9a9545a3e 100644
--- a/tests/thread_msg_block_w_queue/main.c
+++ b/tests/thread_msg_block_w_queue/main.c
@@ -25,7 +25,7 @@
 #include "thread.h"
 #include "msg.h"
 
-char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char t1_stack[THREAD_STACKSIZE_MAIN];
 
 kernel_pid_t p1 = KERNEL_PID_UNDEF, p_main = KERNEL_PID_UNDEF;
 
@@ -59,7 +59,7 @@ int main(void)
     msg_t msg_q[1];
     msg_init_queue(msg_q, 1);
 
-    p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
+    p1 = thread_create(t1_stack, sizeof(t1_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        thread1, NULL, "nr1");
 
diff --git a/tests/thread_msg_block_wo_queue/main.c b/tests/thread_msg_block_wo_queue/main.c
index 1808f2edcd..0b0aed9e46 100644
--- a/tests/thread_msg_block_wo_queue/main.c
+++ b/tests/thread_msg_block_wo_queue/main.c
@@ -25,7 +25,7 @@
 #include "thread.h"
 #include "msg.h"
 
-char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char t1_stack[THREAD_STACKSIZE_MAIN];
 
 kernel_pid_t p1 = KERNEL_PID_UNDEF, p_main = KERNEL_PID_UNDEF;
 
@@ -56,7 +56,7 @@ int main(void)
     msg_t msg;
     p_main = sched_active_pid;
 
-    p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
+    p1 = thread_create(t1_stack, sizeof(t1_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        thread1, NULL, "nr1");
 
diff --git a/tests/thread_msg_seq/main.c b/tests/thread_msg_seq/main.c
index dee49b9b16..4e430135c5 100644
--- a/tests/thread_msg_seq/main.c
+++ b/tests/thread_msg_seq/main.c
@@ -25,9 +25,9 @@
 #include "thread.h"
 #include "msg.h"
 
-char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char t3_stack[KERNEL_CONF_STACKSIZE_MAIN];
+char t1_stack[THREAD_STACKSIZE_MAIN];
+char t2_stack[THREAD_STACKSIZE_MAIN];
+char t3_stack[THREAD_STACKSIZE_MAIN];
 
 kernel_pid_t p_main = KERNEL_PID_UNDEF, p1 = KERNEL_PID_UNDEF,
              p2 = KERNEL_PID_UNDEF, p3 = KERNEL_PID_UNDEF;
@@ -55,13 +55,13 @@ int main(void)
 
     p_main = sched_active_pid;
 
-    p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
+    p1 = thread_create(t1_stack, sizeof(t1_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        sub_thread, "nr1", "nr1");
-    p2 = thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN - 1,
+    p2 = thread_create(t2_stack, sizeof(t2_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        sub_thread, "nr2", "nr2");
-    p3 = thread_create(t3_stack, sizeof(t3_stack), PRIORITY_MAIN - 1,
+    p3 = thread_create(t3_stack, sizeof(t3_stack), THREAD_PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST,
                        sub_thread, "nr3", "nr3");
 
diff --git a/tests/unittests/tests-core/tests-core-ringbuffer.c b/tests/unittests/tests-core/tests-core-ringbuffer.c
index e20ade3de6..694aa20157 100644
--- a/tests/unittests/tests-core/tests-core-ringbuffer.c
+++ b/tests/unittests/tests-core/tests-core-ringbuffer.c
@@ -28,7 +28,7 @@
 #define ITERATIONS 15
 #define BUF_SIZE 7
 
-static char stack_get[KERNEL_CONF_STACKSIZE_DEFAULT];
+static char stack_get[THREAD_STACKSIZE_DEFAULT];
 
 static char rb_buf[BUF_SIZE];
 static ringbuffer_t rb = RINGBUFFER_INIT(rb_buf);
@@ -110,7 +110,7 @@ static void tests_core_ringbuffer(void)
 {
     pid_add = sched_active_pid;
     pid_get = thread_create(stack_get, sizeof (stack_get),
-                            PRIORITY_MAIN, CREATE_SLEEPING | CREATE_STACKTEST,
+                            THREAD_PRIORITY_MAIN, CREATE_SLEEPING | CREATE_STACKTEST,
                             run_get, NULL, "get");
     run_add();
 }
diff --git a/tests/unittests/tests-ubjson/tests-ubjson.c b/tests/unittests/tests-ubjson/tests-ubjson.c
index 2e3ebb5865..a3945985ae 100644
--- a/tests/unittests/tests-ubjson/tests-ubjson.c
+++ b/tests/unittests/tests-ubjson/tests-ubjson.c
@@ -29,7 +29,7 @@ static pipe_t communication_pipe;
 static ringbuffer_t pipe_rb;
 static char pipe_buffer[16];
 
-static char receiver_stack[KERNEL_CONF_STACKSIZE_DEFAULT];
+static char receiver_stack[THREAD_STACKSIZE_DEFAULT];
 
 typedef struct {
     void (*run)(void);
@@ -87,7 +87,7 @@ void test_ubjson_test(void (*sender_fun)(void), void (*receiver_fun)(void))
         },
     };
     kernel_pid_t receiver_pid = thread_create(receiver_stack, sizeof(receiver_stack),
-                                              PRIORITY_MAIN, CREATE_WOUT_YIELD,
+                                              THREAD_PRIORITY_MAIN, CREATE_WOUT_YIELD,
                                               test_ubjson_receiver_trampoline, &data, "receiver");
     TEST_ASSERT(pid_is_valid(receiver_pid));
 
diff --git a/tests/vtimer_msg/main.c b/tests/vtimer_msg/main.c
index 74a2e3fd2b..521e479fc8 100644
--- a/tests/vtimer_msg/main.c
+++ b/tests/vtimer_msg/main.c
@@ -26,8 +26,8 @@
 #include "thread.h"
 #include "msg.h"
 
-char timer_stack[KERNEL_CONF_STACKSIZE_MAIN];
-char timer_stack_local[KERNEL_CONF_STACKSIZE_MAIN];
+char timer_stack[THREAD_STACKSIZE_MAIN];
+char timer_stack_local[THREAD_STACKSIZE_MAIN];
 
 struct timer_msg {
     vtimer_t timer;
@@ -90,7 +90,7 @@ int main(void)
     kernel_pid_t pid = thread_create(
                   timer_stack,
                   sizeof(timer_stack),
-                  PRIORITY_MAIN - 1,
+                  THREAD_PRIORITY_MAIN - 1,
                   CREATE_STACKTEST,
                   timer_thread,
                   NULL,
@@ -107,7 +107,7 @@ int main(void)
     kernel_pid_t pid2 = thread_create(
                    timer_stack_local,
                    sizeof(timer_stack_local),
-                   PRIORITY_MAIN - 1,
+                   THREAD_PRIORITY_MAIN - 1,
                    CREATE_STACKTEST,
                    timer_thread_local,
                    NULL,
diff --git a/tests/vtimer_msg_diff/main.c b/tests/vtimer_msg_diff/main.c
index d64feb27b0..a2c6922119 100644
--- a/tests/vtimer_msg_diff/main.c
+++ b/tests/vtimer_msg_diff/main.c
@@ -31,7 +31,7 @@
 #define MAXCOUNT 100
 #define MAXDIFF 10000
 
-char timer_stack[KERNEL_CONF_STACKSIZE_MAIN*4];
+char timer_stack[THREAD_STACKSIZE_MAIN*4];
 
 struct timer_msg {
     vtimer_t timer;
@@ -104,7 +104,7 @@ int main(void)
     kernel_pid_t pid = thread_create(
                   timer_stack,
                   sizeof(timer_stack),
-                  PRIORITY_MAIN - 1,
+                  THREAD_PRIORITY_MAIN - 1,
                   CREATE_STACKTEST,
                   timer_thread,
                   NULL,
-- 
GitLab