aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/src/chsys.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/kernel/src/chsys.c')
-rw-r--r--os/kernel/src/chsys.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c
index e433a8e42..5bc86807b 100644
--- a/os/kernel/src/chsys.c
+++ b/os/kernel/src/chsys.c
@@ -36,10 +36,17 @@
#include "ch.h"
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
-/* Idle thread working area.*/
+/**
+ * @brief Idle thread working area.
+ */
WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
/**
+ * @brief Main thread structure.
+ */
+Thread _mainthread;
+
+/**
* @brief This function implements the idle thread infinite loop.
* @details The function puts the processor in the lowest power mode capable
* to serve interrupts.<br>
@@ -73,7 +80,6 @@ void _idle_thread(void *p) {
* @special
*/
void chSysInit(void) {
- static Thread mainthread;
#if CH_DBG_ENABLE_STACK_CHECK
extern stkalign_t __main_thread_stack_base__;
#endif
@@ -92,7 +98,7 @@ void chSysInit(void) {
#endif
/* Now this instructions flow becomes the main thread.*/
- setcurrp(_thread_init(&mainthread, NORMALPRIO));
+ setcurrp(_thread_init(&_mainthread, NORMALPRIO));
currp->p_state = THD_STATE_CURRENT;
#if CH_DBG_ENABLE_STACK_CHECK
/* This is a special case because the main thread Thread structure is not