commit 732a4657e2ba4a3bd5b4244e06cfbae9bb2a3e56
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Mon Feb 25 13:42:39 2019 +0100

    ChibiOS updated to version stable_19.1.x.
    NOTE: ChibiOS 19.1.x seems to contain some issues as of now.

diff --git a/kernel/patches/introduce-thread-hierarchy.patch b/kernel/patches/introduce-thread-hierarchy.patch
index 57ef13b..5632a88 100644
--- a/kernel/patches/introduce-thread-hierarchy.patch
+++ b/kernel/patches/introduce-thread-hierarchy.patch
@@ -1,11 +1,11 @@
 diff --git a/os/rt/include/chschd.h b/os/rt/include/chschd.h
-index 1d11d17..c71d8b4 100644
 --- a/os/rt/include/chschd.h
 +++ b/os/rt/include/chschd.h
-@@ -177,6 +177,23 @@ struct ch_thread {
+@@ -176,6 +176,23 @@ struct ch_thread {
+    * @brief   References to this thread.
     */
    trefs_t               refs;
- #endif
++#endif
 +#if (CH_CFG_USE_THREADHIERARCHY == TRUE) || defined(__DOXYGEN__)
 +  /**
 +   * @brief   Pointer to the parent thread.
@@ -22,35 +22,38 @@ index 1d11d17..c71d8b4 100644
 +   * @brief   NULL if there are no more child threads.
 +   */
 +  thread_t              *sibling;
-+#endif
+ #endif
    /**
     * @brief   Number of ticks remaining to this thread.
-    */
 diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h
-index 166d566..b767d74 100644
 --- a/os/rt/include/chthreads.h
 +++ b/os/rt/include/chthreads.h
-@@ -79,6 +79,10 @@ typedef struct {
+@@ -79,6 +79,12 @@ typedef struct {
     * @brief   Thread argument.
     */
    void              *arg;
++#if (CH_CFG_USE_THREADHIERARCHY) == TRUE || defined(__DOXYGEN__)
 +  /**
 +   * @brief   Pointer to the parent thread.
 +   */
 +  thread_t          *parent;
++#endif
  } thread_descriptor_t;
  
  /*===========================================================================*/
-@@ -220,7 +224,7 @@ typedef struct {
+@@ -220,7 +226,11 @@ typedef struct {
  #ifdef __cplusplus
  extern "C" {
  #endif
--   thread_t *_thread_init(thread_t *tp, const char *name, tprio_t prio);
++#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +   thread_t *_thread_init(thread_t *tp, thread_t* parent, const char *name, tprio_t prio);
++#else
+    thread_t *_thread_init(thread_t *tp, const char *name, tprio_t prio);
++#endif
  #if CH_DBG_FILL_THREADS == TRUE
    void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v);
  #endif
-@@ -228,8 +232,13 @@ extern "C" {
+@@ -228,8 +238,13 @@ extern "C" {
    thread_t *chThdCreateSuspended(const thread_descriptor_t *tdp);
    thread_t *chThdCreateI(const thread_descriptor_t *tdp);
    thread_t *chThdCreate(const thread_descriptor_t *tdp);
@@ -65,39 +68,49 @@ index 166d566..b767d74 100644
  #if CH_CFG_USE_REGISTRY == TRUE
    thread_t *chThdAddRef(thread_t *tp);
 diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c
-index 346a8ba..c789d01 100644
 --- a/os/rt/src/chsys.c
 +++ b/os/rt/src/chsys.c
-@@ -126,13 +126,13 @@ void chSysInit(void) {
+@@ -126,14 +126,26 @@ void chSysInit(void) {
  #if CH_CFG_NO_IDLE_THREAD == FALSE
    /* Now this instructions flow becomes the main thread.*/
  #if CH_CFG_USE_REGISTRY == TRUE
--  currp = _thread_init(&ch.mainthread, (const char *)&ch_debug, NORMALPRIO);
++#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +  currp = _thread_init(&ch.mainthread, NULL, (const char *)&ch_debug, NORMALPRIO);
- #else
--  currp = _thread_init(&ch.mainthread, "main", NORMALPRIO);
++#else
+   currp = _thread_init(&ch.mainthread, (const char *)&ch_debug, NORMALPRIO);
++#endif
++#else
++#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +  currp = _thread_init(&ch.mainthread, NULL, "main", NORMALPRIO);
+ #else
+   currp = _thread_init(&ch.mainthread, "main", NORMALPRIO);
  #endif
++#endif
  #else
    /* Now this instructions flow becomes the idle thread.*/
--  currp = _thread_init(&ch.mainthread, "idle", IDLEPRIO);
++#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +  currp = _thread_init(&ch.mainthread, NULL, "idle", IDLEPRIO);
++#else
+   currp = _thread_init(&ch.mainthread, "idle", IDLEPRIO);
  #endif
++#endif
  
  #if CH_DBG_ENABLE_STACK_CHECK == TRUE
-@@ -172,6 +172,7 @@ void chSysInit(void) {
+   {
+@@ -172,6 +184,9 @@ void chSysInit(void) {
        THD_WORKING_AREA_END(ch_idle_thread_wa),
        IDLEPRIO,
        _idle_thread,
++#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +      NULL,
++#endif
        NULL
      };
  
 diff --git a/os/rt/src/chthreads.c b/os/rt/src/chthreads.c
-index 171c683..6bc0f78 100644
 --- a/os/rt/src/chthreads.c
 +++ b/os/rt/src/chthreads.c
-@@ -70,6 +70,46 @@
+@@ -70,22 +70,67 @@
  /* Module local functions.                                                   */
  /*===========================================================================*/
  
@@ -144,7 +157,10 @@ index 171c683..6bc0f78 100644
  /*===========================================================================*/
  /* Module exported functions.                                                */
  /*===========================================================================*/
-@@ -79,13 +119,14 @@
+ 
++#if CH_CFG_USE_THREADHIERARCHY == TRUE || defined(__DOXYGEN__)
+ /**
+  * @brief   Initializes a thread structure.
   * @note    This is an internal functions, do not use it in application code.
   *
   * @param[in] tp        pointer to the thread
@@ -155,12 +171,14 @@ index 171c683..6bc0f78 100644
   *
   * @notapi
   */
--thread_t *_thread_init(thread_t *tp, const char *name, tprio_t prio) {
 +thread_t *_thread_init(thread_t *tp, thread_t *parent,  const char *name, tprio_t prio) {
++#else
+ thread_t *_thread_init(thread_t *tp, const char *name, tprio_t prio) {
++#endif
  
    tp->prio      = prio;
    tp->state     = CH_STATE_WTSTART;
-@@ -110,6 +151,17 @@ thread_t *_thread_init(thread_t *tp, const char *name, tprio_t prio) {
+@@ -110,6 +155,17 @@ thread_t *_thread_init(thread_t *tp, const char *name, tprio_t prio) {
  #else
    (void)name;
  #endif
@@ -178,16 +196,27 @@ index 171c683..6bc0f78 100644
  #if CH_CFG_USE_WAITEXIT == TRUE
    list_init(&tp->waiting);
  #endif
-@@ -190,7 +242,7 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) {
+@@ -190,7 +246,11 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) {
    PORT_SETUP_CONTEXT(tp, tdp->wbase, tp, tdp->funcp, tdp->arg);
  
    /* The driver object is initialized but not started.*/
--  return _thread_init(tp, tdp->name, tdp->prio);
++#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +  return _thread_init(tp, tdp->parent, tdp->name, tdp->prio);
++#else
+   return _thread_init(tp, tdp->name, tdp->prio);
++#endif
+ }
+ 
+ /**
+@@ -300,6 +360,7 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
+   return tp;
  }
  
++#if CH_CFG_USE_THREADHIERARCHY == TRUE || defined(__DOXYGEN__)
  /**
-@@ -315,13 +367,21 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
+  * @brief   Creates a new thread into a static memory area.
+  * @post    The created thread has a reference counter set to one, it is
+@@ -315,13 +376,20 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
   * @param[in] pf        the thread function
   * @param[in] arg       an argument passed to the thread function. It can be
   *                      @p NULL.
@@ -199,7 +228,6 @@ index 171c683..6bc0f78 100644
   *
   * @api
   */
-+#if (CH_CFG_USE_THREADHIERARCHY == TRUE) || defined(__DOXYGEN__)
 +thread_t *chThdCreateStatic(void *wsp, size_t size,
 +                            tprio_t prio, tfunc_t pf, void *arg, thread_t *parent) {
 +#else
@@ -209,20 +237,19 @@ index 171c683..6bc0f78 100644
    thread_t *tp;
  
    chDbgCheck((wsp != NULL) &&
-@@ -358,7 +418,11 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
+@@ -358,7 +426,11 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
    /* Setting up the port-dependent part of the working area.*/
    PORT_SETUP_CONTEXT(tp, wsp, tp, pf, arg);
  
--  tp = _thread_init(tp, "noname", prio);
 +#if CH_CFG_USE_THREADHIERARCHY == TRUE
 +  tp = _thread_init(tp, parent, "noname", prio);
 +#else
-+  tp = _thread_init(tp, NULL, "noname", prio);
+   tp = _thread_init(tp, "noname", prio);
 +#endif
  
    /* Starting the thread immediately.*/
    chSchWakeupS(tp, MSG_OK);
-@@ -529,6 +593,30 @@ void chThdExitS(msg_t msg) {
+@@ -529,6 +601,30 @@ void chThdExitS(msg_t msg) {
  #endif
  #endif
  
@@ -253,10 +280,11 @@ index 171c683..6bc0f78 100644
    /* Going into final state.*/
    chSchGoSleepS(CH_STATE_FINAL);
  
-@@ -611,6 +699,43 @@ tprio_t chThdSetPriority(tprio_t newprio) {
+@@ -610,6 +706,43 @@ tprio_t chThdSetPriority(tprio_t newprio) {
+ #else
    oldprio = currp->prio;
    currp->prio = newprio;
- #endif
++#endif
 +#if (CH_CFG_USE_THREADHIERARCHY == TRUE) && (CH_CFG_THREADHIERARCHY_ORDERED == TRUE)
 +  /* Reorder sibling list. */
 +  if (currp->parent != NULL && newprio != oldprio) {
@@ -293,12 +321,10 @@ index 171c683..6bc0f78 100644
 +      }
 +    }
 +  }
-+#endif
+ #endif
    chSchRescheduleS();
    chSysUnlock();
- 
 diff --git a/test/rt/source/test/rt_test_root.c b/test/rt/source/test/rt_test_root.c
-index e03d0f1..150d33d 100644
 --- a/test/rt/source/test/rt_test_root.c
 +++ b/test/rt/source/test/rt_test_root.c
 @@ -106,6 +106,14 @@ void * ROMCONST wa[5] = {test_buffer + (WA_SIZE * 0),
@@ -317,7 +343,6 @@ index e03d0f1..150d33d 100644
   * Sets a termination request in all the test-spawned threads.
   */
 diff --git a/test/rt/source/test/rt_test_root.h b/test/rt/source/test/rt_test_root.h
-index 6da777b..0cd40fc 100644
 --- a/test/rt/source/test/rt_test_root.h
 +++ b/test/rt/source/test/rt_test_root.h
 @@ -88,6 +88,7 @@ extern thread_t *threads[MAX_THREADS];
@@ -329,7 +354,6 @@ index 6da777b..0cd40fc 100644
  void test_wait_threads(void);
  systime_t test_wait_tick(void);
 diff --git a/test/rt/source/test/rt_test_sequence_001.c b/test/rt/source/test/rt_test_sequence_001.c
-index 6f2b96f..f91c23f 100644
 --- a/test/rt/source/test/rt_test_sequence_001.c
 +++ b/test/rt/source/test/rt_test_sequence_001.c
 @@ -193,6 +193,12 @@ static void rt_test_001_003_execute(void) {
@@ -347,7 +371,7 @@ index 6f2b96f..f91c23f 100644
      test_println("");
 @@ -207,7 +213,7 @@ static void rt_test_001_003_execute(void) {
      test_println("");
-     test_print("--- CH_CFG_USE_MUTEXES_RECURS:          ");
+     test_print("--- CH_CFG_USE_MUTEXES_RECURSIVE:       ");
      test_printn(CH_CFG_USE_MUTEXES_RECURSIVE);
 -    test_println("");   
 +    test_println("");
@@ -355,7 +379,6 @@ index 6f2b96f..f91c23f 100644
      test_printn(CH_CFG_USE_CONDVARS);
      test_println("");
 diff --git a/test/rt/source/test/rt_test_sequence_003.c b/test/rt/source/test/rt_test_sequence_003.c
-index 8598b12..f1ece71 100644
 --- a/test/rt/source/test/rt_test_sequence_003.c
 +++ b/test/rt/source/test/rt_test_sequence_003.c
 @@ -46,6 +46,20 @@ static THD_FUNCTION(thread, p) {
@@ -836,18 +859,17 @@ index 8598b12..f1ece71 100644
  /****************************************************************************
   * Exported data.
   ****************************************************************************/
-@@ -339,6 +752,9 @@ const testcase_t * const rt_test_sequence_003_array[] = {
+@@ -338,6 +751,9 @@ const testcase_t * const rt_test_sequence_003_array[] = {
+   &rt_test_003_003,
  #if (CH_CFG_USE_MUTEXES) || defined(__DOXYGEN__)
    &rt_test_003_004,
- #endif
++#endif
 +#if (CH_CFG_USE_THREADHIERARCHY) || defined(__DOXYGEN__)
 +  &rt_test_003_005,
-+#endif
+ #endif
    NULL
  };
- 
 diff --git a/test/rt/source/test/rt_test_sequence_004.c b/test/rt/source/test/rt_test_sequence_004.c
-index 7ad2ab5..4226ffc 100644
 --- a/test/rt/source/test/rt_test_sequence_004.c
 +++ b/test/rt/source/test/rt_test_sequence_004.c
 @@ -83,7 +83,7 @@ static void rt_test_004_001_execute(void) {
@@ -860,7 +882,6 @@ index 7ad2ab5..4226ffc 100644
      msg = chThdSuspendTimeoutS(&tr1, TIME_INFINITE);
      chSysUnlock();
 diff --git a/test/rt/source/test/rt_test_sequence_005.c b/test/rt/source/test/rt_test_sequence_005.c
-index 29cebb9..3cde985 100644
 --- a/test/rt/source/test/rt_test_sequence_005.c
 +++ b/test/rt/source/test/rt_test_sequence_005.c
 @@ -178,11 +178,11 @@ static void rt_test_005_002_execute(void) {
@@ -917,7 +938,6 @@ index 29cebb9..3cde985 100644
    }
  
 diff --git a/test/rt/source/test/rt_test_sequence_006.c b/test/rt/source/test/rt_test_sequence_006.c
-index 3694755..4d50caa 100644
 --- a/test/rt/source/test/rt_test_sequence_006.c
 +++ b/test/rt/source/test/rt_test_sequence_006.c
 @@ -276,11 +276,11 @@ static void rt_test_006_001_execute(void) {
@@ -1038,7 +1058,6 @@ index 3694755..4d50caa 100644
  
    /* [6.9.5] Signaling C1: TA wakes up, unlocks M1 and priority goes to
 diff --git a/test/rt/source/test/rt_test_sequence_007.c b/test/rt/source/test/rt_test_sequence_007.c
-index 62a9df9..6dabea2 100644
 --- a/test/rt/source/test/rt_test_sequence_007.c
 +++ b/test/rt/source/test/rt_test_sequence_007.c
 @@ -79,7 +79,7 @@ static void rt_test_007_001_execute(void) {
@@ -1051,7 +1070,6 @@ index 62a9df9..6dabea2 100644
    }
  
 diff --git a/test/rt/source/test/rt_test_sequence_008.c b/test/rt/source/test/rt_test_sequence_008.c
-index d2bb805..cead16b 100644
 --- a/test/rt/source/test/rt_test_sequence_008.c
 +++ b/test/rt/source/test/rt_test_sequence_008.c
 @@ -226,7 +226,7 @@ static void rt_test_008_003_execute(void) {
@@ -1091,7 +1109,6 @@ index d2bb805..cead16b 100644
    }
  
 diff --git a/test/rt/source/test/rt_test_sequence_010.c b/test/rt/source/test/rt_test_sequence_010.c
-index 1c77343..e21c840 100644
 --- a/test/rt/source/test/rt_test_sequence_010.c
 +++ b/test/rt/source/test/rt_test_sequence_010.c
 @@ -169,7 +169,7 @@ static void rt_test_010_001_execute(void) {
