commit 17d978fea4976105f0c5385d412d271393a202e9
Author: skenneweg <skenneweg@techfak.uni-bielefeld.de>
Date:   Sat Jun 6 17:00:49 2020 +0200

    Added some asserts for debugging (not finished yet)
    Started to write nodes main function
    Fixed error in node (Use one core for all functions)

diff --git a/inc/urt_core.h b/inc/urt_core.h
index f3476a2..d29d232 100644
--- a/inc/urt_core.h
+++ b/inc/urt_core.h
@@ -57,6 +57,8 @@ typedef struct urt_core
   #endif /* URT_CFG_RPC_ENABLED */
 }urt_core_t;
 
+static urt_core_t core;
+
 /******************************************************************************/
 /* MACROS                                                                     */
 /******************************************************************************/
diff --git a/inc/urt_debug.h b/inc/urt_debug.h
deleted file mode 100644
index d5a406e..0000000
--- a/inc/urt_debug.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-µRtWare is a lightweight publish/subscribe middleware for real-time
-applications. It was developed as part of the software habitat for the
-Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well.
-
-Copyright (C) 2018..2020  Thomas Schöpping et al.
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef URT_DEBUG_H
-#define URT_DEBUG_H
-
-/******************************************************************************/
-/* CONSTANTS                                                                  */
-/******************************************************************************/
-
-/******************************************************************************/
-/* SETTINGS                                                                   */
-/******************************************************************************/
-
-/******************************************************************************/
-/* CHECKS                                                                     */
-/******************************************************************************/
-
-/******************************************************************************/
-/* DATA STRUCTURES AND TYPES                                                  */
-/******************************************************************************/
-
-/******************************************************************************/
-/* MACROS                                                                     */
-/******************************************************************************/
-
-/******************************************************************************/
-/* EXTERN DECLARATIONS                                                        */
-/******************************************************************************/
-
-#if defined(__cplusplus)
-extern "C" {
-#endif /* defined(__cplusplus) */
-
-  void urtDebugAssert (bool condition);
-
-#if defined(__cplusplus)
-}
-#endif /* defined(__cplusplus) */
-
-/******************************************************************************/
-/* INLINE FUNCTIONS                                                           */
-/******************************************************************************/
-
-#endif /* URT_DEBUG_H */
diff --git a/src/urt_core.c b/src/urt_core.c
index 555c9cd..b7083b7 100644
--- a/src/urt_core.c
+++ b/src/urt_core.c
@@ -33,8 +33,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* LOCAL TYPES                                                                */
 /******************************************************************************/
 
-urt_core_t core;
-
 /******************************************************************************/
 /* LOCAL VARIABLES                                                            */
 /******************************************************************************/
@@ -103,6 +101,8 @@ void urtCoreStartNodes(void)
  */
 urt_status_t urtCoreSynchronizeNodes(urt_node_t* node)
 {
+  urtDebugAssert(node != NULL);
+
   urtMutexLock(&core._lock);
   node->stage -= 1;
   urt_node_t* nodeFromCore = core._nodes;
diff --git a/src/urt_node.c b/src/urt_node.c
index 0854560..8109d02 100644
--- a/src/urt_node.c
+++ b/src/urt_node.c
@@ -37,16 +37,45 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* LOCAL VARIABLES                                                            */
 /******************************************************************************/
 
+urt_node_t localNode; //TODO:Correct?
+
 /******************************************************************************/
 /* LOCAL FUNCTIONS                                                            */
 /******************************************************************************/
 
+/**
+ * @brief  Main function of a node.
+ *
+ * @param[in] arg  Optional Argument to the thread main function.
+ */
+void _main(void* arg)
+{
+    //TODO: Register to core event
+    if (localNode.setupcallback != NULL)
+    {
+        // urt_osEventMask_t mask = localNode.setupcallback(localNode, arg);
+        // TODOs
+    }
+    else
+    {
+        //TODO: act as if setupcallback returned 0xF..F
+    }
+    if (core._status == URT_STATUS_OK)
+    {
+        //TODO: Suspend all child threads
+        urtCoreSynchronizeNodes(&localNode);
+        //TODO: Resume all child threads
+    }
+    //TODOs
+    return;
+}
+
 /******************************************************************************/
 /* EXPORTED FUNCTIONS                                                         */
 /******************************************************************************/
 
 /**
- * @brief  Initalize the node.
+ * @brief  Initalize a node.
  *
  * @param[in] node  The node to initialize. Must not be NULL.
  * @param[in] thread  The already initialized, exclusive thread for the node. Must not be NULL.
@@ -69,6 +98,16 @@ void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback
                  void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams,
                  urt_nodeShutdownCallback_t* shutdowncallback, void* shutdownparams)
 {
+  urtDebugAssert(node != NULL);
+  urtDebugAssert(thread != NULL);
+  //TODO: Setupcallback
+  if (setupcallback == NULL)
+    urtDebugAssert(setupparams == NULL);
+  urtDebugAssert(loopcallback != NULL);
+  //urtDebugAssert(/*loopparams*/);
+  //urtDebugAssert(shutdowncallback);
+  //urtDebugAssert(shutdownparams);
+
   node->next = NULL;
   node->thread = thread;
   node->setupcallback = setupcallback;
@@ -82,10 +121,10 @@ void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback
   #if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
     node->loops = 0;
   #endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */
-  urt_core_t temp; //TODO: Correct?
-  urtMutexLock(&temp._lock);
-    node->next = temp._nodes;
-    temp._nodes = node;
-  urtMutexUnlock(&temp._lock);
+  urtMutexLock(&core._lock);
+    node->next = core._nodes;
+    core._nodes = node;
+  urtMutexUnlock(&core._lock);
+  localNode = *node;
   return;
 }
