commit 1ef74af51ceae78b533b33a9de68f725528881bc
Author: Simon Welzel <simonwelzel@live.de>
Date:   Fri Nov 23 15:44:16 2018 +0100

    Integrated SSSP switch to all modules and core files. Warnings have to be dealt with at a later time

diff --git a/core/inc/aos_confcheck.h b/core/inc/aos_confcheck.h
index bf16754..5d67b08 100644
--- a/core/inc/aos_confcheck.h
+++ b/core/inc/aos_confcheck.h
@@ -49,6 +49,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
   #error "AMIROOS_CFG_MAIN_LOOP_TIMEOUT not defined in aosconf.h"
 #endif
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
+
 /*
  * SSSP parameters and options
  */
@@ -80,6 +82,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
   #error "AMIROOS_CFG_SSSP_SYSSYNCPERIOD not defined in aosconf.h"
 #endif
 
+#endif
 /*
  * System shell options
  */
diff --git a/core/inc/aos_system.h b/core/inc/aos_system.h
index 9c02d25..89fbe33 100644
--- a/core/inc/aos_system.h
+++ b/core/inc/aos_system.h
@@ -63,6 +63,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #define AOS_SYSTEM_EVENTFLAGS_RESTART           (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 4))
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
+
 /**
  * @brief   Major version of the implemented SSSP.
  */
@@ -79,6 +81,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #define AOS_SYSTEM_SSSP_TIMEOUT                 (10 * AMIROOS_CFG_SSSP_SIGNALDELAY)
 
+#endif
+
 /**
  * @brief   Enumerator to identify shutdown types.
  */
@@ -91,6 +95,8 @@ typedef enum aos_shutdown {
   AOS_SHUTDOWN_RESTART,         /**< Active saystem restart request. */
 } aos_shutdown_t;
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
+
 /**
  * @brief   Enumerator of the several stages of SSSP.
  */
@@ -113,16 +119,21 @@ typedef enum aos_ssspstage {
   AOS_SSSP_SHUTDOWN_3   = 0x38, /**< Identifier of SSSP shutdown phase stage 3. */
 } aos_ssspstage_t;
 
+#endif
+
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /**
  * @brief   Type to represent module IDs.
  */
 typedef uint16_t aos_ssspmoduleid_t;
+#endif
+
 
 /**
  * @brief   AMiRo-OS base system structure.
  */
 typedef struct aos_system {
-
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
   /**
    * @brief   SSSP relevant data.
    */
@@ -139,7 +150,7 @@ typedef struct aos_system {
      */
     aos_ssspmoduleid_t moduleId;
   } sssp;
-
+#endif
   /**
    * @brief   System I/O stream.
    */
@@ -191,7 +202,9 @@ extern "C" {
   void aosSysInit(void);
 #endif
   void aosSysStart(void);
+  #if (AMIROOS_CFG_SSSP_ENABLE == true)
   eventmask_t aosSysSsspStartupOsInitSyncCheck(event_listener_t* syncEvtListener);
+#endif
   void aosSysGetUptimeX(aos_timestamp_t* ut);
   void aosSysGetDateTime(struct tm* dt);
   void aosSysSetDateTime(struct tm* dt);
diff --git a/core/src/aos_main.cpp b/core/src/aos_main.cpp
index 4498840..f1a23be 100644
--- a/core/src/aos_main.cpp
+++ b/core/src/aos_main.cpp
@@ -61,6 +61,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #define DELAYEVENT_MASK                         EVENT_MASK(4)
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
+
 /**
  * @brief   CAN message identifier for initialization of the SSSP stack initialization sequence.
  */
@@ -76,6 +78,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #define SSSP_STACKINIT_CANMSGID_ABORT           0x001
 
+#endif
+
 /**
  * @brief   CAN message identifier for calender synchronization message.
  */
@@ -129,6 +133,8 @@ static inline void _unexpectedEventError(const eventmask_t mask, const eventflag
   return;
 }
 
+
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /**
  * @brief   Callback function to be used during SSSP stack initialization sequence.
  *
@@ -144,7 +150,7 @@ static void _ssspTimerCallback(void* par)
 
   return;
 }
-
+#endif
 /**
  * @brief   Helper function to serialize data.
  *
@@ -241,7 +247,7 @@ inline void _U642TM(struct tm* dst, const uint64_t src)
 
   return;
 }
-
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /**
  * @brief   Implementation of the SSSP module stack initialization sequence (startup phase 3).
  *
@@ -837,7 +843,7 @@ aos_shutdown_t _ssspModuleStackInitialization(void)
 
   return shutdown;
 }
-
+#endif
 /**
  * @brief   Application entry point.
  */
@@ -928,6 +934,7 @@ int main(void)
 #endif
 #endif
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
   /* event associations */
 #if (AMIROOS_CFG_SSSP_STACK_START == true) && (AMIROOS_CFG_SSSP_STACK_END == true)
   chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC);
@@ -938,6 +945,7 @@ int main(void)
 #else
   chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC | MODULE_SSSP_EVENTFLAGS_DN | MODULE_SSSP_EVENTFLAGS_UP);
 #endif
+#endif // end of AMIROOS_CFG_SSSP_ENABLE condition
   chEvtRegisterMask(&aos.events.os, &_eventListenerOS, OSEVENT_MASK);
 
 #if defined(AMIROOS_CFG_MAIN_INIT_HOOK_5)
@@ -1001,6 +1009,7 @@ int main(void)
 #endif
 #endif
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
   /* SSSP startup OS synchronization phase (end of startup stage 2) */
   while ((shutdown == AOS_SHUTDOWN_NONE) && (eventmask = aosSysSsspStartupOsInitSyncCheck(&_eventListenerIO)) != 0) {
     /*
@@ -1198,7 +1207,9 @@ int main(void)
     AMIROOS_CFG_MAIN_LOOP_HOOK_1();
 #endif
 #endif
+
   }
+#endif
 
   /*
    * ##########################################################################
diff --git a/core/src/aos_system.c b/core/src/aos_system.c
index f692fe4..f475d0d 100644
--- a/core/src/aos_system.c
+++ b/core/src/aos_system.c
@@ -79,18 +79,22 @@ static aos_timestamp_t _uptime;
  */
 static systime_t _synctime;
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if (AMIROOS_CFG_SSSP_MASTER == true) || defined(__DOXYGEN__)
 /**
  * @brief   Timer to drive the SYS_SYNC signal for system wide time synchronization according to SSSP.
  */
 static virtual_timer_t _syssynctimer;
 
+#endif
+
 /**
  * @brief   Last uptime of system wide time synchronization.
  */
 static aos_timestamp_t _syssynctime;
 #endif
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if ((AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__)
 /**
  * @brief   Offset between local clock and system wide synchronization signal.
@@ -102,6 +106,7 @@ static float _syssyncskew;
  */
 #define SYSTEM_SYSSYNCSKEW_LPFACTOR   (0.1f / AOS_SYSTEM_TIME_RESOLUTION)
 #endif
+#endif
 
 #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
 /**
@@ -246,7 +251,9 @@ static void _printSystemInfo(BaseSequentialStream* stream)
 #endif
   _printSystemInfoLine(stream, "Architecture", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_ARCHITECTURE_NAME);
   _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
   _printSystemInfoLine(stream, "AMiRo-OS" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", AMIROOS_VERSION_MAJOR, AMIROOS_VERSION_MINOR, AMIROOS_VERSION_PATCH, AMIROOS_RELEASE_TYPE, AOS_SYSTEM_SSSP_VERSION_MAJOR, AOS_SYSTEM_SSSP_VERSION_MINOR);
+#endif
   _printSystemInfoLine(stream, "AMiRo-LLD" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (periphAL %u.%u)", AMIRO_LLD_VERSION_MAJOR, AMIRO_LLD_VERSION_MINOR, AMIRO_LLD_VERSION_PATCH, AMIRO_LLD_RELEASE_TYPE, PERIPHAL_VERSION_MAJOR, PERIPHAL_VERSION_MINOR);
   _printSystemInfoLine(stream, "ChibiOS/RT" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_KERNEL_MAJOR, CH_KERNEL_MINOR, CH_KERNEL_PATCH, (CH_KERNEL_STABLE == 1) ? "stable" : "non-stable");
   _printSystemInfoLine(stream, "ChibiOS/HAL", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_HAL_MAJOR, CH_HAL_MINOR, CH_HAL_PATCH, (CH_HAL_STABLE == 1) ? "stable" : "non-stable");
@@ -257,6 +264,7 @@ static void _printSystemInfo(BaseSequentialStream* stream)
   // print static information about the bootloader
   _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
   if (BL_CALLBACK_TABLE_ADDRESS->magicNumber == BL_MAGIC_NUMBER) {
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
     _printSystemInfoLine(stream, "AMiRo-BLT", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", BL_CALLBACK_TABLE_ADDRESS->vBootloader.major, BL_CALLBACK_TABLE_ADDRESS->vBootloader.minor, BL_CALLBACK_TABLE_ADDRESS->vBootloader.patch,
                          (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_Release) ? "stable" :
                          (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_ReleaseCandidate) ? "release candidate" :
@@ -265,6 +273,7 @@ static void _printSystemInfo(BaseSequentialStream* stream)
                          (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_PreAlpha) ? "pre-alpha" :
                          "<release type unknown>",
                          BL_CALLBACK_TABLE_ADDRESS->vSSSP.major, BL_CALLBACK_TABLE_ADDRESS->vSSSP.minor);
+
     if (BL_CALLBACK_TABLE_ADDRESS->vSSSP.major != AOS_SYSTEM_SSSP_VERSION_MAJOR) {
       if (stream) {
         chprintf(stream, "WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n");
@@ -272,6 +281,7 @@ static void _printSystemInfo(BaseSequentialStream* stream)
         aosprintf("WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n");
       }
     }
+#endif
     _printSystemInfoLine(stream, "Compiler", SYSTEM_INFO_NAMEWIDTH, "%s %u.%u.%u", (BL_CALLBACK_TABLE_ADDRESS->vCompiler.identifier == BL_VERSION_ID_GCC) ? "GCC" : "<compiler unknown>", BL_CALLBACK_TABLE_ADDRESS->vCompiler.major, BL_CALLBACK_TABLE_ADDRESS->vCompiler.minor, BL_CALLBACK_TABLE_ADDRESS->vCompiler.patch); // TODO: support other compilers than GCC
   } else {
     if (stream) {
@@ -283,11 +293,13 @@ static void _printSystemInfo(BaseSequentialStream* stream)
 
   // print dynamic information about the module
   _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
+  #if (AMIROOS_CFG_SSSP_ENABLE == true)
   if (aos.sssp.moduleId != 0) {
     _printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "%u", aos.sssp.moduleId);
   } else {
     _printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "not available");
   }
+#endif
   _printSystemInfoLine(stream, "Date", SYSTEM_INFO_NAMEWIDTH, "%s %02u-%02u-%04u", (dt.tm_wday == 0) ? "Sunday" : (dt.tm_wday == 1) ? "Monday" : (dt.tm_wday == 2) ? "Tuesday" : (dt.tm_wday == 3) ? "Wednesday" : (dt.tm_wday == 4) ? "Thursday" : (dt.tm_wday == 5) ? "Friday" : "Saturday",
                        dt.tm_mday,
                        dt.tm_mon + 1,
@@ -496,11 +508,12 @@ static int _shellcmd_infocb(BaseSequentialStream* stream, int argc, char* argv[]
   chprintf(stream, "%10u seconds\n", (uint8_t)(uptime % MICROSECONDS_PER_MINUTE / MICROSECONDS_PER_SECOND));
   chprintf(stream, "%10u milliseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_SECOND / MICROSECONDS_PER_MILLISECOND));
   chprintf(stream, "%10u microseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_MILLISECOND / MICROSECONDS_PER_MICROSECOND));
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
   chprintf(stream, "SSSP synchronization offset: %.3fus per %uus\n", _syssyncskew, AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
 #endif /* AMIROOS_CFG_SSSP_MASTER != true && AMIROOS_CFG_PROFILE == true */
   _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
-
+#endif
 #if (AMIROOS_CFG_SHELL_ENABLE == true)
   // print shell info
   chprintf(stream, "System shell information:\n");
@@ -621,6 +634,7 @@ static void _intCallback(void* args)
   return;
 }
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if (AMIROOS_CFG_SSSP_MASTER != true) || defined(__DOXYGEN__)
 /**
  * @brief   Callback function for the Sync signal interrupt.
@@ -664,6 +678,7 @@ static void _signalSyncCallback(void *args)
   return;
 }
 #endif
+#endif
 
 /**
  * @brief   Callback function for the uptime accumulation timer.
@@ -686,7 +701,7 @@ static void _uptimeCallback(void* par)
 
   return;
 }
-
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if (AMIROOS_CFG_SSSP_MASTER == true) || defined (__DOXYGEN__)
 /**
  * @brief   Periodic system synchronization callback function.
@@ -722,6 +737,7 @@ static void _sysSyncTimerCallback(void* par)
   return;
 }
 #endif
+#endif
 
 /**
  * @brief   AMiRo-OS system initialization.
@@ -742,6 +758,7 @@ void aosSysInit(void)
   chVTObjectInit(&_systimer);
   _synctime = 0;
   _uptime = 0;
+  #if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if (AMIROOS_CFG_SSSP_MASTER == true)
   chVTObjectInit(&_syssynctimer);
   _syssynctime = 0;
@@ -749,16 +766,20 @@ void aosSysInit(void)
 #if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
   _syssyncskew = 0.0f;
 #endif
+#endif
 
+  #if (AMIROOS_CFG_SSSP_ENABLE == true)
   /* initialize aos configuration */
   aos.sssp.stage = AOS_SSSP_STARTUP_2_1;
   aos.sssp.moduleId = 0;
+#endif
   aosIOStreamInit(&aos.iostream);
   chEvtObjectInit(&aos.events.io);
   chEvtObjectInit(&aos.events.os);
 
   /* interrupt setup */
   // PD signal
+  #if (AMIROOS_CFG_SSSP_ENABLE == true)
   palSetPadCallback(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, _intCallback, &moduleSsspGpioPd.gpio->pad);
   palEnablePadEvent(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, APAL2CH_EDGE(moduleSsspGpioPd.meta.edge));
   // SYNC signal
@@ -778,6 +799,7 @@ void aosSysInit(void)
   palSetPadCallback(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, _intCallback, &moduleSsspGpioUp.gpio->pad);
   palEnablePadEvent(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, APAL2CH_EDGE(moduleSsspGpioUp.meta.edge));
 #endif
+#endif
 #ifdef MODULE_INIT_INTERRUPTS
   // further interrupt signals
   MODULE_INIT_INTERRUPTS();
@@ -809,6 +831,7 @@ void aosSysInit(void)
  */
 inline void aosSysStart(void)
 {
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
   // update the system SSSP stage
   aos.sssp.stage = AOS_SSSP_OPERATION;
 
@@ -824,6 +847,7 @@ inline void aosSysStart(void)
     chSysUnlock();
   }
 #endif
+#endif
 
   // print system information;
   _printSystemInfo((BaseSequentialStream*)&aos.iostream);
@@ -840,7 +864,7 @@ inline void aosSysStart(void)
 
   return;
 }
-
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /**
  * @brief   Implements the SSSP startup synchronization step.
  *
@@ -891,6 +915,7 @@ eventmask_t aosSysSsspStartupOsInitSyncCheck(event_listener_t* syncEvtListener)
     return m;
   }
 }
+#endif
 
 /**
  * @brief   Retrieves the system uptime.
@@ -949,6 +974,7 @@ void aosSysShutdownInit(aos_shutdown_t shutdown)
   // check arguments
   aosDbgCheck(shutdown != AOS_SHUTDOWN_NONE);
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 #if (AMIROOS_CFG_SSSP_MASTER == true)
   // deactivate the system synchronization timer
   chVTReset(&_syssynctimer);
@@ -965,6 +991,7 @@ void aosSysShutdownInit(aos_shutdown_t shutdown)
   // activate the SYS_SYNC signal
   apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON);
   chSysUnlock();
+#endif
 
   switch (shutdown) {
     case AOS_SHUTDOWN_PASSIVE:
@@ -992,10 +1019,10 @@ void aosSysShutdownInit(aos_shutdown_t shutdown)
    default:
       break;
   }
-
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
   // update the system SSSP stage
   aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_2;
-
+#endif
   return;
 }
 
@@ -1033,8 +1060,10 @@ void aosSysShutdownFinal(aos_shutdown_t shutdown)
   // disable all interrupts
   irqDeinit();
 
+  #if (AMIROOS_CFG_SSSP_ENABLE == true)
   // update the system SSSP stage
   aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3;
+#endif
 
   // call bootloader callback depending on arguments
   switch (shutdown) {
diff --git a/core/src/aos_system.c.autosave b/core/src/aos_system.c.autosave
deleted file mode 100644
index bbd2645..0000000
--- a/core/src/aos_system.c.autosave
+++ /dev/null
@@ -1,1065 +0,0 @@
-/*
-AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
-Copyright (C) 2016..2018  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/>.
-*/
-
-/**
- * @file    aos_system.c
- * @brief   System code.
- * @details Contains system initialization and shutdown routines
- *          and system shell commands.
- *
- * @addtogroup aos_system
- * @{
- */
-
-#include <aos_system.h>
-
-#include <amiroos.h>
-#include <amiroblt.h>
-#include <module.h>
-#include <string.h>
-#include <stdlib.h>
-#if (AMIROOS_CFG_TESTS_ENABLE == true)
-#include <ch_test.h>
-#include <rt_test_root.h>
-#endif
-
-/**
- * @brief   Period of the system timer.
- */
-#define SYSTIMER_PERIOD               (TIME_MAX_SYSTIME - CH_CFG_ST_TIMEDELTA)
-
-/**
- * @brief   Width of the printable system info text.
- */
-#define SYSTEM_INFO_WIDTH             70
-
-/**
- * @brief   Width of the name column of the system info table.
- */
-#define SYSTEM_INFO_NAMEWIDTH         14
-
-/* forward declarations */
-static void _printSystemInfo(BaseSequentialStream* stream);
-#if (AMIROOS_CFG_SHELL_ENABLE == true)
-static int _shellcmd_configcb(BaseSequentialStream* stream, int argc, char* argv[]);
-static int _shellcmd_infocb(BaseSequentialStream* stream, int argc, char* argv[]);
-static int _shellcmd_shutdowncb(BaseSequentialStream* stream, int argc, char* argv[]);
-#if (AMIROOS_CFG_TESTS_ENABLE == true)
-static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char* argv[]);
-#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
-#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
-
-/**
- * @brief   Timer to accumulate system uptime.
- */
-static virtual_timer_t _systimer;
-
-/**
- * @brief   Accumulated system uptime.
- */
-static aos_timestamp_t _uptime;
-
-/**
- * @brief   Timer register value of last accumulation.
- */
-static systime_t _synctime;
-
-#if (AMIROOS_CFG_SSSP_MASTER == true) || defined(__DOXYGEN__)
-/**
- * @brief   Timer to drive the SYS_SYNC signal for system wide time synchronization according to SSSP.
- */
-static virtual_timer_t _syssynctimer;
-
-/**
- * @brief   Last uptime of system wide time synchronization.
- */
-static aos_timestamp_t _syssynctime;
-#endif
-
-#if ((AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__)
-/**
- * @brief   Offset between local clock and system wide synchronization signal.
- */
-static float _syssyncskew;
-
-/**
- * @brief   Weighting factor for the low-pass filter used for calculating the @p _syssyncskew value.
- */
-#define SYSTEM_SYSSYNCSKEW_LPFACTOR   (0.1f / AOS_SYSTEM_TIME_RESOLUTION)
-#endif
-
-#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
-/**
- * @brief   Shell thread working area.
- */
-THD_WORKING_AREA(_shell_wa, AMIROOS_CFG_SHELL_STACKSIZE);
-
-/**
- * @brief   Shell input buffer.
- */
-static char _shell_line[AMIROOS_CFG_SHELL_LINEWIDTH];
-
-/**
- * @brief   Shell argument buffer.
- */
-static char* _shell_arglist[AMIROOS_CFG_SHELL_MAXARGS];
-
-/**
- * @brief   Shell command to retrieve system information.
- */
-static aos_shellcommand_t _shellcmd_info = {
-  /* name     */ "module:info",
-  /* callback */ _shellcmd_infocb,
-  /* next     */ NULL,
-};
-
-/**
- * @brief   Shell command to set or retrieve system configuration.
- */
-static aos_shellcommand_t _shellcmd_config = {
-  /* name     */ "module:config",
-  /* callback */ _shellcmd_configcb,
-  /* next     */ NULL,
-};
-
-/**
- * @brief   Shell command to shutdown the system.
- */
-static aos_shellcommand_t _shellcmd_shutdown = {
-  /* name     */ "system:shutdown",
-  /* callback */ _shellcmd_shutdowncb,
-  /* next     */ NULL,
-};
-#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
-
-#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
-/**
- * @brief   Shell kommand to run a test of the ChibiOS/RT kernel.
- */
-static aos_shellcommand_t _shellcmd_kerneltest = {
-  /* name     */ "kernel:test",
-  /* callback */ _shellcmd_kerneltestcb,
-  /* next     */ NULL,
-};
-#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
-
-/**
- * @brief   Global system object.
- */
-aos_system_t aos;
-
-/**
- * @brief   Print a separator line.
- *
- * @param[in] stream    Stream to print to or NULL to print to all system streams.
- * @param[in] c         Character to use.
- * @param[in] n         Length of the separator line.
- *
- * @return  Number of characters printed.
- */
-static unsigned int _printSystemInfoSeparator(BaseSequentialStream* stream, const char c, const unsigned int n)
-{
-  aosDbgCheck(stream != NULL);
-
-  // print the specified character n times
-  for (unsigned int i = 0; i < n; ++i) {
-    streamPut(stream, c);
-  }
-  streamPut(stream, '\n');
-
-  return n+1;
-}
-
-/**
- * @brief   Print a system information line.
- * @details Prints a system information line with the following format:
- *            "<name>[spaces]fmt"
- *          The combined width of "<name>[spaces]" can be specified in order to align <fmt> on multiple lines.
- *          Note that there is not trailing newline added implicitely.
- *
- * @param[in] stream      Stream to print to or NULL to print to all system streams.
- * @param[in] name        Name of the entry/line.
- * @param[in] namewidth   Width of the name column.
- * @param[in] fmt         Formatted string of information content.
- *
- * @return  Number of characters printed.
- */
-static unsigned int _printSystemInfoLine(BaseSequentialStream* stream, const char* name, const unsigned int namewidth, const char* fmt, ...)
-{
-  aosDbgCheck(stream != NULL);
-  aosDbgCheck(name != NULL);
-
-  unsigned int n = 0;
-  va_list ap;
-
-  va_start(ap, fmt);
-  n += chprintf(stream, name);
-  while (n < namewidth) {
-    streamPut(stream, ' ');
-    ++n;
-  }
-  n += chvprintf(stream, fmt, ap);
-  va_end(ap);
-
-  streamPut(stream, '\n');
-  ++n;
-
-  return n;
-}
-
-/**
- * @brief   Prints information about the system.
- *
- * @param[in] stream    Stream to print to.
- */
-static void _printSystemInfo(BaseSequentialStream* stream)
-{
-  aosDbgCheck(stream != NULL);
-
-  // local variables
-  struct tm dt;
-  aosSysGetDateTime(&dt);
-
-  // print static information about module and operating system
-  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
-  _printSystemInfoLine(stream, "Module", SYSTEM_INFO_NAMEWIDTH, "%s (v%s)", BOARD_NAME, BOARD_VERSION);
-#ifdef PLATFORM_NAME
-  _printSystemInfoLine(stream, "Platform", SYSTEM_INFO_NAMEWIDTH, "%s", PLATFORM_NAME);
-#endif
-#ifdef PORT_CORE_VARIANT_NAME
-  _printSystemInfoLine(stream, "Core Variant", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_CORE_VARIANT_NAME);
-#endif
-  _printSystemInfoLine(stream, "Architecture", SYSTEM_INFO_NAMEWIDTH, "%s", PORT_ARCHITECTURE_NAME);
-  _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
-  _printSystemInfoLine(stream, "AMiRo-OS" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", AMIROOS_VERSION_MAJOR, AMIROOS_VERSION_MINOR, AMIROOS_VERSION_PATCH, AMIROOS_RELEASE_TYPE, AOS_SYSTEM_SSSP_VERSION_MAJOR, AOS_SYSTEM_SSSP_VERSION_MINOR);
-  _printSystemInfoLine(stream, "AMiRo-LLD" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (periphAL %u.%u)", AMIRO_LLD_VERSION_MAJOR, AMIRO_LLD_VERSION_MINOR, AMIRO_LLD_VERSION_PATCH, AMIRO_LLD_RELEASE_TYPE, PERIPHAL_VERSION_MAJOR, PERIPHAL_VERSION_MINOR);
-  _printSystemInfoLine(stream, "ChibiOS/RT" , SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_KERNEL_MAJOR, CH_KERNEL_MINOR, CH_KERNEL_PATCH, (CH_KERNEL_STABLE == 1) ? "stable" : "non-stable");
-  _printSystemInfoLine(stream, "ChibiOS/HAL", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s", CH_HAL_MAJOR, CH_HAL_MINOR, CH_HAL_PATCH, (CH_HAL_STABLE == 1) ? "stable" : "non-stable");
-  _printSystemInfoLine(stream, "build type", SYSTEM_INFO_NAMEWIDTH,"%s", (AMIROOS_CFG_DBG == true) ? "debug" : "release");
-  _printSystemInfoLine(stream, "Compiler" , SYSTEM_INFO_NAMEWIDTH, "%s %u.%u.%u", "GCC", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); // TODO: support other compilers than GCC
-  _printSystemInfoLine(stream, "Compiled" , SYSTEM_INFO_NAMEWIDTH, "%s - %s", __DATE__, __TIME__);
-
-  // print static information about the bootloader
-  _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
-  if (BL_CALLBACK_TABLE_ADDRESS->magicNumber == BL_MAGIC_NUMBER) {
-    _printSystemInfoLine(stream, "AMiRo-BLT", SYSTEM_INFO_NAMEWIDTH, "%u.%u.%u %s (SSSP %u.%u)", BL_CALLBACK_TABLE_ADDRESS->vBootloader.major, BL_CALLBACK_TABLE_ADDRESS->vBootloader.minor, BL_CALLBACK_TABLE_ADDRESS->vBootloader.patch,
-                         (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_Release) ? "stable" :
-                         (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_ReleaseCandidate) ? "release candidate" :
-                         (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_Beta) ? "beta" :
-                         (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_Alpha) ? "alpha" :
-                         (BL_CALLBACK_TABLE_ADDRESS->vBootloader.identifier == BL_VERSION_ID_AMiRoBLT_PreAlpha) ? "pre-alpha" :
-                         "<release type unknown>",
-                         BL_CALLBACK_TABLE_ADDRESS->vSSSP.major, BL_CALLBACK_TABLE_ADDRESS->vSSSP.minor);
-    if (BL_CALLBACK_TABLE_ADDRESS->vSSSP.major != AOS_SYSTEM_SSSP_VERSION_MAJOR) {
-      if (stream) {
-        chprintf(stream, "WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n");
-      } else {
-        aosprintf("WARNING: Bootloader and AMiRo-OS implement incompatible SSSP versions!\n");
-      }
-    }
-    _printSystemInfoLine(stream, "Compiler", SYSTEM_INFO_NAMEWIDTH, "%s %u.%u.%u", (BL_CALLBACK_TABLE_ADDRESS->vCompiler.identifier == BL_VERSION_ID_GCC) ? "GCC" : "<compiler unknown>", BL_CALLBACK_TABLE_ADDRESS->vCompiler.major, BL_CALLBACK_TABLE_ADDRESS->vCompiler.minor, BL_CALLBACK_TABLE_ADDRESS->vCompiler.patch); // TODO: support other compilers than GCC
-  } else {
-    if (stream) {
-      chprintf(stream, "Bootloader incompatible or not available.\n");
-    } else {
-      aosprintf("Bootloader incompatible or not available.\n");
-    }
-  }
-
-  // print dynamic information about the module
-  _printSystemInfoSeparator(stream, '-', SYSTEM_INFO_WIDTH);
-  if (aos.sssp.moduleId != 0) {
-    _printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "%u", aos.sssp.moduleId);
-  } else {
-    _printSystemInfoLine(stream, "Module ID", SYSTEM_INFO_NAMEWIDTH, "not available");
-  }
-  _printSystemInfoLine(stream, "Date", SYSTEM_INFO_NAMEWIDTH, "%s %02u-%02u-%04u", (dt.tm_wday == 0) ? "Sunday" : (dt.tm_wday == 1) ? "Monday" : (dt.tm_wday == 2) ? "Tuesday" : (dt.tm_wday == 3) ? "Wednesday" : (dt.tm_wday == 4) ? "Thursday" : (dt.tm_wday == 5) ? "Friday" : "Saturday",
-                       dt.tm_mday,
-                       dt.tm_mon + 1,
-                       dt.tm_year + 1900);
-  _printSystemInfoLine(stream, "Time", SYSTEM_INFO_NAMEWIDTH, "%02u:%02u:%02u", dt.tm_hour, dt.tm_min, dt.tm_sec);
-
-  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
-
-  return;
-}
-
-#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
-/**
- * @brief   Callback function for the system:config shell command.
- *
- * @param[in] stream    The I/O stream to use.
- * @param[in] argc      Number of arguments.
- * @param[in] argv      List of pointers to the arguments.
- *
- * @return              An exit status.
- * @retval  AOS_OK                  The command was executed successfuly.
- * @retval  AOS_INVALID_ARGUMENTS   There was an issue with the arguemnts.
- */
-static int _shellcmd_configcb(BaseSequentialStream* stream, int argc, char* argv[])
-{
-  aosDbgCheck(stream != NULL);
-
-  // local variables
-  int retval = AOS_INVALID_ARGUMENTS;
-
-  // if there are additional arguments
-  if (argc > 1) {
-    // if the user wants to set or retrieve the shell configuration
-    if (strcmp(argv[1], "--shell") == 0) {
-      // if the user wants to modify the shell configuration
-      if (argc > 2) {
-        // if the user wants to modify the prompt
-        if (strcmp(argv[2], "prompt") == 0) {
-          // there must be a further argument
-          if (argc > 3) {
-            // handle the option
-            if (strcmp(argv[3], "text") == 0) {
-              aos.shell.config &= ~AOS_SHELL_CONFIG_PROMPT_MINIMAL;
-              retval = AOS_OK;
-            }
-            else if (strcmp(argv[3], "minimal") == 0) {
-              aos.shell.config |= AOS_SHELL_CONFIG_PROMPT_MINIMAL;
-              retval = AOS_OK;
-            }
-            else if (strcmp(argv[3], "notime") == 0) {
-              aos.shell.config &= ~(AOS_SHELL_CONFIG_PROMPT_UPTIME | AOS_SHELL_CONFIG_PROMPT_DATETIME);
-              retval = AOS_OK;
-            }
-            else if (strcmp(argv[3], "uptime") == 0) {
-              aos.shell.config &= ~AOS_SHELL_CONFIG_PROMPT_DATETIME;
-              aos.shell.config |= AOS_SHELL_CONFIG_PROMPT_UPTIME;
-              retval = AOS_OK;
-            }
-            else if (strcmp(argv[3], "date&time") == 0) {
-              aos.shell.config &= ~AOS_SHELL_CONFIG_PROMPT_UPTIME;
-              aos.shell.config |= AOS_SHELL_CONFIG_PROMPT_DATETIME;
-              retval = AOS_OK;
-            }
-            else {
-              chprintf(stream, "unknown option '%s'\n", argv[3]);
-              return AOS_INVALID_ARGUMENTS;
-            }
-          }
-        }
-        // if the user wants to modify the string matching
-        else if (strcmp(argv[2], "match") == 0) {
-          // there must be a further argument
-          if (argc > 3) {
-            if (strcmp(argv[3], "casesensitive") == 0) {
-              aos.shell.config |= AOS_SHELL_CONFIG_MATCH_CASE;
-              retval = AOS_OK;
-            }
-            else if (strcmp(argv[3], "caseinsensitive") == 0) {
-              aos.shell.config &= ~AOS_SHELL_CONFIG_MATCH_CASE;
-              retval = AOS_OK;
-            }
-          }
-        }
-      }
-      // if the user wants to retrieve the shell configuration
-      else {
-        chprintf(stream, "current shell configuration:\n");
-        chprintf(stream, "  prompt text:   %s\n",
-                 (aos.shell.prompt != NULL) ? aos.shell.prompt : "n/a");
-        char time[10];
-        switch (aos.shell.config & (AOS_SHELL_CONFIG_PROMPT_UPTIME | AOS_SHELL_CONFIG_PROMPT_DATETIME)) {
-          case AOS_SHELL_CONFIG_PROMPT_UPTIME:
-            strcpy(time, "uptime"); break;
-          case AOS_SHELL_CONFIG_PROMPT_DATETIME:
-            strcpy(time, "date&time"); break;
-          default:
-            strcpy(time, "no time"); break;
-        }
-        chprintf(stream, "  prompt style:  %s, %s\n",
-                 (aos.shell.config & AOS_SHELL_CONFIG_PROMPT_MINIMAL) ? "minimal" : "text",
-                 time);
-        chprintf(stream, "  input method:  %s\n",
-                 (aos.shell.config & AOS_SHELL_CONFIG_INPUT_OVERWRITE) ? "replace" : "insert");
-        chprintf(stream, "  text matching: %s\n",
-                 (aos.shell.config & AOS_SHELL_CONFIG_MATCH_CASE) ? "case sensitive" : "case insensitive");
-        retval = AOS_OK;
-      }
-    }
-    // if the user wants to configure the date or time
-    else if (strcmp(argv[1], "--date&time") == 0 && argc == 4) {
-      struct tm dt;
-      aosSysGetDateTime(&dt);
-      unsigned int val = atoi(argv[3]);
-      if (strcmp(argv[2], "year") == 0) {
-        dt.tm_year = val - 1900;
-      }
-      else if (strcmp(argv[2], "month") == 0 && val <= 12) {
-        dt.tm_mon = val - 1;
-      }
-      else if (strcmp(argv[2], "day") == 0 && val <= 31) {
-        dt.tm_mday = val;
-      }
-      else if (strcmp(argv[2], "hour") == 0 && val < 24) {
-        dt.tm_hour = val;
-      }
-      else if (strcmp(argv[2], "minute") == 0 && val < 60) {
-        dt.tm_min = val;
-      }
-      else if (strcmp(argv[2], "second") == 0 && val < 60) {
-        dt.tm_sec = val;
-      }
-      else {
-        chprintf(stream, "unknown option '%s' or value '%s'\n", argv[2], argv[3]);
-        return AOS_INVALID_ARGUMENTS;
-      }
-      dt.tm_wday = aosTimeDayOfWeekFromDate(dt.tm_mday, dt.tm_mon+1, dt.tm_year+1900) % 7;
-      aosSysSetDateTime(&dt);
-
-      // read and print new date and time
-      aosSysGetDateTime(&dt);
-      chprintf(stream, "date/time set to %02u:%02u:%02u @ %02u-%02u-%04u\n",
-               dt.tm_hour, dt.tm_min, dt.tm_sec,
-               dt.tm_mday, dt.tm_mon+1, dt.tm_year+1900);
-
-      retval = AOS_OK;
-    }
-  }
-
-  // print help, if required
-  if (retval == AOS_INVALID_ARGUMENTS) {
-    chprintf(stream, "Usage: %s OPTION\n", argv[0]);
-    chprintf(stream, "Options:\n");
-    chprintf(stream, "  --help\n");
-    chprintf(stream, "    Print this help text.\n");
-    chprintf(stream, "  --shell [OPT [VAL]]\n");
-    chprintf(stream, "    Set or retrieve shell configuration.\n");
-    chprintf(stream, "    Possible OPTs and VALs are:\n");
-    chprintf(stream, "      prompt text|minimal|uptime|date&time|notime\n");
-    chprintf(stream, "        Configures the prompt.\n");
-    chprintf(stream, "      match casesensitive|caseinsenitive\n");
-    chprintf(stream, "        Configures string matching.\n");
-    chprintf(stream, "  --date&time OPT VAL\n");
-    chprintf(stream, "    Set the date/time value of OPT to VAL.\n");
-    chprintf(stream, "    Possible OPTs are:\n");
-    chprintf(stream, "      year\n");
-    chprintf(stream, "      month\n");
-    chprintf(stream, "      day\n");
-    chprintf(stream, "      hour\n");
-    chprintf(stream, "      minute\n");
-    chprintf(stream, "      second\n");
-  }
-
-  return (argc > 1 && strcmp(argv[1], "--help") == 0) ? AOS_OK : retval;
-}
-
-/**
- * @brief   Callback function for the system:info shell command.
- *
- * @param[in] stream    The I/O stream to use.
- * @param[in] argc      Number of arguments.
- * @param[in] argv      List of pointers to the arguments.
- *
- * @return            An exit status.
- * @retval  AOS_OK    The command was executed successfully.
- */
-static int _shellcmd_infocb(BaseSequentialStream* stream, int argc, char* argv[])
-{
-  aosDbgCheck(stream != NULL);
-
-  (void)argc;
-  (void)argv;
-
-  // print system information
-  _printSystemInfo(stream);
-
-  // print time measurement precision
-  chprintf(stream, "module time resolution: %uus\n", AOS_SYSTEM_TIME_RESOLUTION);
-
-  // print system uptime
-  aos_timestamp_t uptime;
-  aosSysGetUptime(&uptime);
-  chprintf(stream, "The system is running for\n");
-  chprintf(stream, "%10u days\n", (uint32_t)(uptime / MICROSECONDS_PER_DAY));
-  chprintf(stream, "%10u hours\n", (uint8_t)(uptime % MICROSECONDS_PER_DAY / MICROSECONDS_PER_HOUR));
-  chprintf(stream, "%10u minutes\n", (uint8_t)(uptime % MICROSECONDS_PER_HOUR / MICROSECONDS_PER_MINUTE));
-  chprintf(stream, "%10u seconds\n", (uint8_t)(uptime % MICROSECONDS_PER_MINUTE / MICROSECONDS_PER_SECOND));
-  chprintf(stream, "%10u milliseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_SECOND / MICROSECONDS_PER_MILLISECOND));
-  chprintf(stream, "%10u microseconds\n", (uint16_t)(uptime % MICROSECONDS_PER_MILLISECOND / MICROSECONDS_PER_MICROSECOND));
-#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
-  chprintf(stream, "SSSP synchronization offset: %.3fus per %uus\n", _syssyncskew, AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
-#endif /* AMIROOS_CFG_SSSP_MASTER != true && AMIROOS_CFG_PROFILE == true */
-  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
-
-#if (AMIROOS_CFG_SHELL_ENABLE == true)
-  // print shell info
-  chprintf(stream, "System shell information:\n");
-  chprintf(stream, "\tnumber of commands:      %u\n", aosShellCountCommands(&aos.shell));
-  chprintf(stream, "\tmaximum line width:      %u characters\n", aos.shell.linesize);
-  chprintf(stream, "\tmaximum #arguments:      %u\n", aos.shell.arglistsize);
-  chprintf(stream, "\tshell thread stack size: %u bytes\n", aosThdGetStacksize(aos.shell.thread));
-#if (CH_DBG_FILL_THREADS == TRUE)
-  chprintf(stream, "\tstack peak utilization:  %u bytes (%.2f%%)\n", aosThdGetStackPeakUtilization(aos.shell.thread), (float)aosThdGetStackPeakUtilization(aos.shell.thread) / (float)aosThdGetStacksize(aos.shell.thread) * 100.0f);
-#endif /* CH_DBG_FILL_THREADS == TRUE */
-  _printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH);
-#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
-
-  return AOS_OK;
-}
-
-/**
- * @brief   Callback function for the sytem:shutdown shell command.
- *
- * @param[in] stream    The I/O stream to use.
- * @param[in] argc      Number of arguments.
- * @param[in] argv      List of pointers to the arguments.
- *
- * @return              An exit status.
- * @retval  AOS_OK                  The command was executed successfully.
- * @retval  AOS_INVALID_ARGUMENTS   There was an issue with the arguments.
- */
-static int _shellcmd_shutdowncb(BaseSequentialStream* stream, int argc, char* argv[])
-{
-  aosDbgCheck(stream != NULL);
-
-  // print help text
-  if (argc != 2 || strcmp(argv[1], "--help") == 0) {
-    chprintf(stream, "Usage: %s OPTION\n", argv[0]);
-    chprintf(stream, "Options:\n");
-    chprintf(stream, "  --help\n");
-    chprintf(stream, "    Print this help text.\n");
-    chprintf(stream, "  --hibernate, -h\n");
-    chprintf(stream, "    Shutdown to hibernate mode.\n");
-    chprintf(stream, "    Least energy saving, but allows charging via pins.\n");
-    chprintf(stream, "  --deepsleep, -d\n");
-    chprintf(stream, "    Shutdown to deepsleep mode.\n");
-    chprintf(stream, "    Minimum energy consumption while allowing charging via plug.\n");
-    chprintf(stream, "  --transportation, -t\n");
-    chprintf(stream, "    Shutdown to transportation mode.\n");
-    chprintf(stream, "    Minimum energy consumption with all interrupts disabled (no charging).\n");
-    chprintf(stream, "  --restart, -r\n");
-    chprintf(stream, "    Shutdown and restart system.\n");
-
-    return (argc != 2) ? AOS_INVALID_ARGUMENTS : AOS_OK;
-  }
-  // handle argument
-  else {
-    if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--hibernate") == 0) {
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_HIBERNATE);
-      chThdTerminate(chThdGetSelfX());
-      return AOS_OK;
-    }
-    else if (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "--deepsleep") == 0) {
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_DEEPSLEEP);
-      chThdTerminate(chThdGetSelfX());
-      return AOS_OK;
-    }
-    else if (strcmp(argv[1], "-t") == 0 || strcmp(argv[1], "--transportation") == 0) {
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_TRANSPORTATION);
-      chThdTerminate(chThdGetSelfX());
-      return AOS_OK;
-    }
-    else if (strcmp(argv[1], "-r") == 0 || strcmp(argv[1], "--restart") == 0) {
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_RESTART);
-      chThdTerminate(chThdGetSelfX());
-      return AOS_OK;
-    }
-    else {
-      chprintf(stream, "unknown argument %s\n", argv[1]);
-      return AOS_INVALID_ARGUMENTS;
-    }
-  }
-}
-
-#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__)
-/**
- * @brief   Callback function for the kernel:test shell command.
- *
- * @param[in] stream    The I/O stream to use.
- * @param[in] argc      Number of arguments.
- * @param[in] argv      List of pointers to the arguments.
- *
- * @return      An exit status.
- */
-static int _shellcmd_kerneltestcb(BaseSequentialStream* stream, int argc, char* argv[])
-{
-  aosDbgCheck(stream != NULL);
-
-  (void)argc;
-  (void)argv;
-
-  msg_t retval = test_execute(stream, &rt_test_suite);
-
-  return retval;
-}
-#endif /* AMIROOS_CFG_TESTS_ENABLE == true */
-#endif /* AMIROOS_CFG_SHELL_ENABLE == true */
-
-/**
- * @brief   Generic callback function for GPIO interrupts.
- *
- * @param[in] args   Pointer to the GPIO pad identifier.
- */
-static void _intCallback(void* args)
-{
-  aosDbgCheck((args != NULL) && (*((iopadid_t*)args) < sizeof(eventflags_t) * 8));
-
-  chSysLockFromISR();
-  chEvtBroadcastFlagsI(&aos.events.io, (eventflags_t)1 << *((iopadid_t*)args));
-  chSysUnlockFromISR();
-
-  return;
-}
-
-#if (AMIROOS_CFG_SSSP_MASTER != true) || defined(__DOXYGEN__)
-/**
- * @brief   Callback function for the Sync signal interrupt.
- *
- * @param[in] args   Pointer to the GPIO pad identifier.
- */
-static void _signalSyncCallback(void *args)
-{
-  aosDbgCheck((args != NULL) && (*((iopadid_t*)args) < sizeof(eventflags_t) * 8));
-
-  apalControlGpioState_t s_state;
-  aos_timestamp_t uptime;
-
-  chSysLockFromISR();
-  // if the system is in operation phase
-  if (aos.sssp.stage == AOS_SSSP_OPERATION) {
-    // read signal S
-    apalControlGpioGet(&moduleSsspGpioSync, &s_state);
-    // if S was toggled from on to off
-    if (s_state == APAL_GPIO_OFF) {
-      // get current uptime
-      aosSysGetUptimeX(&uptime);
-      // align the uptime with the synchronization period
-      if (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD < AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2) {
-        _uptime -= uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD;
-#if (AMIROOS_CFG_PROFILE == true)
-        _syssyncskew = ((1.0f - SYSTEM_SYSSYNCSKEW_LPFACTOR) * _syssyncskew) + (SYSTEM_SYSSYNCSKEW_LPFACTOR * (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD));
-#endif
-      } else {
-        _uptime += AMIROOS_CFG_SSSP_SYSSYNCPERIOD - (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
-#if (AMIROOS_CFG_PROFILE == true)
-        _syssyncskew = ((1.0f - SYSTEM_SYSSYNCSKEW_LPFACTOR) * _syssyncskew) - (SYSTEM_SYSSYNCSKEW_LPFACTOR * (AMIROOS_CFG_SSSP_SYSSYNCPERIOD - (uptime % AMIROOS_CFG_SSSP_SYSSYNCPERIOD)));
-#endif
-      }
-    }
-  }
-  // broadcast event
-  chEvtBroadcastFlagsI(&aos.events.io, (eventflags_t)1 << *((iopadid_t*)args));
-  chSysUnlockFromISR();
-
-  return;
-}
-#endif
-
-/**
- * @brief   Callback function for the uptime accumulation timer.
- *
- * @param[in] par   Generic parameter.
- */
-static void _uptimeCallback(void* par)
-{
-  (void)par;
-
-  chSysLockFromISR();
-  // read current time in system ticks
-  register const systime_t st = chVTGetSystemTimeX();
-  // update the uptime variables
-  _uptime += chTimeI2US(chTimeDiffX(_synctime, st));
-  _synctime = st;
-  // enable the timer again
-  chVTSetI(&_systimer, SYSTIMER_PERIOD, &_uptimeCallback, NULL);
-  chSysUnlockFromISR();
-
-  return;
-}
-
-#if (AMIROOS_CFG_SSSP_MASTER == true) || defined (__DOXYGEN__)
-/**
- * @brief   Periodic system synchronization callback function.
- * @details Toggles the SYS_SYNC signal and reconfigures the system synchronization timer.
- *
- * @param[in] par   Unuesed parameters.
- */
-static void _sysSyncTimerCallback(void* par)
-{
-  (void)par;
-
-  apalControlGpioState_t s_state;
-  aos_timestamp_t uptime;
-
-  chSysLockFromISR();
-  // toggle and read signal S
-  apalGpioToggle(moduleSsspGpioSync.gpio);
-  apalControlGpioGet(&moduleSsspGpioSync, &s_state);
-  // if S was toggled from off to on
-  if (s_state == APAL_GPIO_ON) {
-    // reconfigure the timer precisely, because the logically falling edge (next interrupt) snychronizes the system time
-    _syssynctime += AMIROOS_CFG_SSSP_SYSSYNCPERIOD;
-    aosSysGetUptimeX(&uptime);
-    chVTSetI(&_syssynctimer, chTimeUS2I(_syssynctime - uptime), _sysSyncTimerCallback, NULL);
-  }
-  // if S was toggled from on to off
-  else /* if (s_state == APAL_GPIO_OFF) */ {
-    // reconfigure the timer (lazy)
-    chVTSetI(&_syssynctimer, chTimeUS2I(AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2), _sysSyncTimerCallback, NULL);
-  }
-  chSysUnlockFromISR();
-
-  return;
-}
-#endif
-
-/**
- * @brief   AMiRo-OS system initialization.
- * @note    Must be called from the system control thread (usually main thread).
- *
- * @param[in] shellPrompt   String to be printed as prompt of the system shell.
- */
-#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__)
-void aosSysInit(const char* shellPrompt)
-#else
-void aosSysInit(void)
-#endif
-{
-  /* set control thread to maximum priority */
-  chThdSetPriority(AOS_THD_CTRLPRIO);
-
-  /* set local variables */
-  chVTObjectInit(&_systimer);
-  _synctime = 0;
-  _uptime = 0;
-#if (AMIROOS_CFG_SSSP_MASTER == true)
-  chVTObjectInit(&_syssynctimer);
-  _syssynctime = 0;
-#endif
-#if (AMIROOS_CFG_SSSP_MASTER != true) && (AMIROOS_CFG_PROFILE == true)
-  _syssyncskew = 0.0f;
-#endif
-
-  /* initialize aos configuration */
-  aos.sssp.stage = AOS_SSSP_STARTUP_2_1;
-  aos.sssp.moduleId = 0;
-  aosIOStreamInit(&aos.iostream);
-  chEvtObjectInit(&aos.events.io);
-  chEvtObjectInit(&aos.events.os);
-
-  /* interrupt setup */
-  // PD signal
-  palSetPadCallback(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, _intCallback, &moduleSsspGpioPd.gpio->pad);
-  palEnablePadEvent(moduleSsspGpioPd.gpio->port, moduleSsspGpioPd.gpio->pad, APAL2CH_EDGE(moduleSsspGpioPd.meta.edge));
-  // SYNC signal
-#if (AMIROOS_CFG_SSSP_MASTER == true)
-  palSetPadCallback(moduleSsspGpioSync.gpio->port, moduleSsspGpioSync.gpio->pad, _intCallback, &moduleSsspGpioSync.gpio->pad);
-#else
-  palSetPadCallback(moduleSsspGpioSync.gpio->port, moduleSsspGpioSync.gpio->pad, _signalSyncCallback, &moduleSsspGpioSync.gpio->pad);
-#endif
-  palEnablePadEvent(moduleSsspGpioSync.gpio->port, moduleSsspGpioSync.gpio->pad, APAL2CH_EDGE(moduleSsspGpioSync.meta.edge));
-#if (AMIROOS_CFG_SSSP_STACK_START != true)
-  // DN signal
-  palSetPadCallback(moduleSsspGpioDn.gpio->port, moduleSsspGpioDn.gpio->pad, _intCallback, &moduleSsspGpioDn.gpio->pad);
-  palEnablePadEvent(moduleSsspGpioDn.gpio->port, moduleSsspGpioDn.gpio->pad, APAL2CH_EDGE(moduleSsspGpioDn.meta.edge));
-#endif
-#if (AMIROOS_CFG_SSSP_STACK_END != true)
-  // UP signal
-  palSetPadCallback(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, _intCallback, &moduleSsspGpioUp.gpio->pad);
-  palEnablePadEvent(moduleSsspGpioUp.gpio->port, moduleSsspGpioUp.gpio->pad, APAL2CH_EDGE(moduleSsspGpioUp.meta.edge));
-#endif
-#ifdef MODULE_INIT_INTERRUPTS
-  // further interrupt signals
-  MODULE_INIT_INTERRUPTS();
-#endif
-
-#if (AMIROOS_CFG_SHELL_ENABLE == true)
-  /* init shell */
-  aosShellInit(&aos.shell,
-               &aos.events.os,
-               shellPrompt,
-               _shell_line,
-               AMIROOS_CFG_SHELL_LINEWIDTH,
-               _shell_arglist,
-               AMIROOS_CFG_SHELL_MAXARGS);
-  // add system commands
-  aosShellAddCommand(&aos.shell, &_shellcmd_config);
-  aosShellAddCommand(&aos.shell, &_shellcmd_info);
-  aosShellAddCommand(&aos.shell, &_shellcmd_shutdown);
-#if (AMIROOS_CFG_TESTS_ENABLE == true)
-  aosShellAddCommand(&aos.shell, &_shellcmd_kerneltest);
-#endif
-#endif
-
-  return;
-}
-
-/**
- * @brief   Starts the system and all system threads.
- */
-inline void aosSysStart(void)
-{
-  // update the system SSSP stage
-  aos.sssp.stage = AOS_SSSP_OPERATION;
-
-#if (AMIROOS_CFG_SSSP_MASTER == true)
-  {
-    chSysLock();
-    // start the system synchronization counter
-    // The first iteration of the timer is set to the next 'center' of a 'slice'.
-    aos_timestamp_t t;
-    aosSysGetUptimeX(&t);
-    t = AMIROOS_CFG_SSSP_SYSSYNCPERIOD - (t % AMIROOS_CFG_SSSP_SYSSYNCPERIOD);
-    chVTSetI(&_syssynctimer, chTimeUS2I((t > (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) ? (t - (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2)) : (t + (AMIROOS_CFG_SSSP_SYSSYNCPERIOD / 2))), _sysSyncTimerCallback, NULL);
-    chSysUnlock();
-  }
-#endif
-
-  // print system information;
-  _printSystemInfo((BaseSequentialStream*)&aos.iostream);
-  aosprintf("\n");
-
-#if (AMIROOS_CFG_SHELL_ENABLE == true)
-  // start system shell thread
-#if (CH_CFG_USE_THREADHIERARCHY == TRUE)
-  aos.shell.thread = chThdCreateStatic(_shell_wa, sizeof(_shell_wa), AMIROOS_CFG_SHELL_THREADPRIO, aosShellThread, &aos.shell, &ch.mainthread);
-#else
-  aos.shell.thread = chThdCreateStatic(_shell_wa, sizeof(_shell_wa), AMIROOS_CFG_SHELL_THREADPRIO, aosShellThread, &aos.shell);
-#endif
-#endif
-
-  return;
-}
-
-/**
- * @brief   Implements the SSSP startup synchronization step.
- *
- * @param[in] syncEvtListener   Event listener that receives the Sync event.
- *
- * @return    If another event that the listener is interested in was received, its mask is returned.
- *            Otherwise an empty mask (0) is returned.
- */
-eventmask_t aosSysSsspStartupOsInitSyncCheck(event_listener_t* syncEvtListener)
-{
-  aosDbgCheck(syncEvtListener != NULL);
-
-  // local variables
-  eventmask_t m;
-  eventflags_t f;
-  apalControlGpioState_t s;
-
-  // update the system SSSP stage
-  aos.sssp.stage = AOS_SSSP_STARTUP_2_2;
-
-  // deactivate the sync signal to indicate that the module is ready (SSSPv1 stage 2.1 of startup phase)
-  apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
-
-  // wait for any event to occur (do not apply any filter in order not to miss any event)
-  m = chEvtWaitOne(ALL_EVENTS);
-  f = chEvtGetAndClearFlags(syncEvtListener);
-  apalControlGpioGet(&moduleSsspGpioSync, &s);
-
-  // if the event was a system event,
-  //   and it was fired because of the SysSync control signal,
-  //   and the SysSync control signal has been deactivated
-  if (m & syncEvtListener->events &&
-      f == MODULE_SSSP_EVENTFLAGS_SYNC &&
-      s == APAL_GPIO_OFF) {
-    chSysLock();
-    // start the uptime counter
-    _synctime = chVTGetSystemTimeX();
-    _uptime = 0;
-    chVTSetI(&_systimer, SYSTIMER_PERIOD, &_uptimeCallback, NULL);
-    chSysUnlock();
-
-    return 0;
-  }
-  // an unexpected event occurred
-  else {
-    // reassign the flags to the event and return the event mask
-    syncEvtListener->flags |= f;
-    return m;
-  }
-}
-
-/**
- * @brief   Retrieves the system uptime.
- *
- * @param[out] ut   The system uptime.
- */
-inline void aosSysGetUptimeX(aos_timestamp_t* ut)
-{
-  aosDbgCheck(ut != NULL);
-
-  *ut = _uptime + chTimeI2US(chTimeDiffX(_synctime, chVTGetSystemTimeX()));
-
-  return;
-}
-
-/**
- * @brief   retrieves the date and time from the MCU clock.
- *
- * @param[out] td   The date and time.
- */
-void aosSysGetDateTime(struct tm* dt)
-{
-  aosDbgCheck(dt != NULL);
-
-  RTCDateTime rtc;
-  rtcGetTime(&MODULE_HAL_RTC, &rtc);
-  rtcConvertDateTimeToStructTm(&rtc, dt, NULL);
-
-  return;
-}
-
-/**
- * @brief   set the date and time of the MCU clock.
- *
- * @param[in] dt    The date and time to set.
- */
-void aosSysSetDateTime(struct tm* dt)
-{
-  aosDbgCheck(dt != NULL);
-
-  RTCDateTime rtc;
-  rtcConvertStructTmToDateTime(dt, 0, &rtc);
-  rtcSetTime(&, &rtc);
-
-  return;
-}
-
-/**
- * @brief   Initializes/Acknowledges a system shutdown/restart request.
- * @note    This functions should be called from the thread with highest priority.
- *
- * @param[in] shutdown    Type of shutdown.
- */
-void aosSysShutdownInit(aos_shutdown_t shutdown)
-{
-  // check arguments
-  aosDbgCheck(shutdown != AOS_SHUTDOWN_NONE);
-
-#if (AMIROOS_CFG_SSSP_MASTER == true)
-  // deactivate the system synchronization timer
-  chVTReset(&_syssynctimer);
-#endif
-
-  // update the system SSSP stage
-  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_1;
-
-  // activate the SYS_PD control signal only, if this module initiated the shutdown
-  chSysLock();
-  if (shutdown != AOS_SHUTDOWN_PASSIVE) {
-    apalControlGpioSet(&moduleSsspGpioPd, APAL_GPIO_ON);
-  }
-  // activate the SYS_SYNC signal
-  apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON);
-  chSysUnlock();
-
-  switch (shutdown) {
-    case AOS_SHUTDOWN_PASSIVE:
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_SHUTDOWN);
-      aosprintf("shutdown request received...\n");
-      break;
-    case AOS_SHUTDOWN_HIBERNATE:
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_HIBERNATE);
-      aosprintf("shutdown to hibernate mode...\n");
-      break;
-    case AOS_SHUTDOWN_DEEPSLEEP:
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_DEEPSLEEP);
-      aosprintf("shutdown to deepsleep mode...\n");
-      break;
-    case AOS_SHUTDOWN_TRANSPORTATION:
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_TRANSPORTATION);
-      aosprintf("shutdown to transportation mode...\n");
-      break;
-    case AOS_SHUTDOWN_RESTART:
-      chEvtBroadcastFlags(&aos.events.os, AOS_SYSTEM_EVENTFLAGS_RESTART);
-      aosprintf("restarting system...\n");
-      break;
-   // must never occur
-   case AOS_SHUTDOWN_NONE:
-   default:
-      break;
-  }
-
-  // update the system SSSP stage
-  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_2;
-
-  return;
-}
-
-/**
- * @brief   Stops the system and all related threads (not the thread this function is called from).
- */
-void aosSysStop(void)
-{
-#if (AMIROOS_CFG_SHELL_ENABLE == true)
-  chThdWait(aos.shell.thread);
-#endif
-
-  return;
-}
-
-/**
- * @brief   Deinitialize all system variables.
- */
-void aosSysDeinit(void)
-{
-  return;
-}
-
-/**
- * @brief   Finally shuts down the system and calls the bootloader callback function.
- * @note    This function should be called from the thtead with highest priority.
- *
- * @param[in] shutdown    Type of shutdown.
- */
-void aosSysShutdownFinal(aos_shutdown_t shutdown)
-{
-  // check arguments
-  aosDbgCheck(shutdown != AOS_SHUTDOWN_NONE);
-
-  // disable all interrupts
-  irqDeinit();
-
-  // update the system SSSP stage
-  aos.sssp.stage = AOS_SSSP_SHUTDOWN_1_3;
-
-  // call bootloader callback depending on arguments
-  switch (shutdown) {
-    case AOS_SHUTDOWN_PASSIVE:
-      BL_CALLBACK_TABLE_ADDRESS->cbHandleShutdownRequest();
-      break;
-    case AOS_SHUTDOWN_HIBERNATE:
-      BL_CALLBACK_TABLE_ADDRESS->cbShutdownHibernate();
-      break;
-    case AOS_SHUTDOWN_DEEPSLEEP:
-      BL_CALLBACK_TABLE_ADDRESS->cbShutdownDeepsleep();
-      break;
-    case AOS_SHUTDOWN_TRANSPORTATION:
-      BL_CALLBACK_TABLE_ADDRESS->cbShutdownTransportation();
-      break;
-    case AOS_SHUTDOWN_RESTART:
-      BL_CALLBACK_TABLE_ADDRESS->cbShutdownRestart();
-      break;
-    // must never occur
-    case AOS_SHUTDOWN_NONE:
-    default:
-      break;
-  }
-
-  return;
-}
-
-/** @} */
diff --git a/modules/DiWheelDrive_1-1/aosconf.h b/modules/DiWheelDrive_1-1/aosconf.h
index dec35f5..90a1d04 100644
--- a/modules/DiWheelDrive_1-1/aosconf.h
+++ b/modules/DiWheelDrive_1-1/aosconf.h
@@ -98,6 +98,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /*===========================================================================*/
 
 /**
+ * @brief   Flag to enable SSSP.
+ */
+#if !defined(OS_CFG_SSSP_ENABLE)
+  #define AMIROOS_CFG_SSSP_ENABLE               false
+#else
+  #define AMIROOS_CFG_SSSP_ENABLE               OS_CFG_SSSP_ENABLE
+#endif
+
+/**
  * @brief   Flag to set the module as SSSP master.
  * @details There must be only one module with this flag set to true in a system.
  */
diff --git a/modules/LightRing_1-0/aosconf.h b/modules/LightRing_1-0/aosconf.h
index 6ce5233..4fc1157 100644
--- a/modules/LightRing_1-0/aosconf.h
+++ b/modules/LightRing_1-0/aosconf.h
@@ -98,6 +98,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /*===========================================================================*/
 
 /**
+ * @brief   Flag to enable SSSP.
+ */
+#if !defined(OS_CFG_SSSP_ENABLE)
+  #define AMIROOS_CFG_SSSP_ENABLE               false
+#else
+  #define AMIROOS_CFG_SSSP_ENABLE               OS_CFG_SSSP_ENABLE
+#endif
+
+/**
  * @brief   Flag to set the module as SSSP master.
  * @details There must be only one module with this flag set to true in a system.
  */
diff --git a/modules/PowerManagement_1-1/aosconf.h b/modules/PowerManagement_1-1/aosconf.h
index c1c3aa9..070a6fb 100644
--- a/modules/PowerManagement_1-1/aosconf.h
+++ b/modules/PowerManagement_1-1/aosconf.h
@@ -98,6 +98,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /*===========================================================================*/
 
 /**
+ * @brief   Flag to enable SSSP.
+ */
+#if !defined(OS_CFG_SSSP_ENABLE)
+  #define AMIROOS_CFG_SSSP_ENABLE               false
+#else
+  #define AMIROOS_CFG_SSSP_ENABLE               OS_CFG_SSSP_ENABLE
+#endif
+
+/**
  * @brief   Flag to set the module as SSSP master.
  * @details There must be only one module with this flag set to true in a system.
  */
diff --git a/modules/PowerManagement_1-1/module.c b/modules/PowerManagement_1-1/module.c
index f4b800a..6fdd530 100644
--- a/modules/PowerManagement_1-1/module.c
+++ b/modules/PowerManagement_1-1/module.c
@@ -520,7 +520,7 @@ ROMCONST char* moduleShellPrompt = "PowerManagement";
 #endif
 
 /** @} */
-
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /*===========================================================================*/
 /**
  * @name Startup Shutdown Synchronization Protocol (SSSP)
@@ -529,6 +529,7 @@ ROMCONST char* moduleShellPrompt = "PowerManagement";
 /*===========================================================================*/
 
 /** @} */
+#endif
 
 /*===========================================================================*/
 /**
diff --git a/modules/PowerManagement_1-1/module.h b/modules/PowerManagement_1-1/module.h
index c9a231e..1d25a2b 100644
--- a/modules/PowerManagement_1-1/module.h
+++ b/modules/PowerManagement_1-1/module.h
@@ -461,6 +461,7 @@ extern ROMCONST char* moduleShellPrompt;
 
 /** @} */
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /*===========================================================================*/
 /**
  * @name Startup Shutdown Synchronization Protocol (SSSP)
@@ -510,6 +511,7 @@ extern ROMCONST char* moduleShellPrompt;
 
 /** @} */
 
+#endif
 /*===========================================================================*/
 /**
  * @name Low-level drivers
diff --git a/modules/RT-STM32L476RG-NUCLEO64/aosconf.h b/modules/RT-STM32L476RG-NUCLEO64/aosconf.h
index bf7c8ea..d7a5509 100644
--- a/modules/RT-STM32L476RG-NUCLEO64/aosconf.h
+++ b/modules/RT-STM32L476RG-NUCLEO64/aosconf.h
@@ -106,6 +106,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
   #define AMIROOS_CFG_SSSP_ENABLE               OS_CFG_SSSP_ENABLE
 #endif
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /**
  * @brief   Flag to set the module as SSSP master.
  * @details There must be only one module with this flag set to true in a system.
@@ -156,6 +157,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
   #define AMIROOS_CFG_SSSP_SYSSYNCPERIOD        OS_CFG_SSSP_SYSSYNCPERIOD
 #endif
 
+#endif
 /** @} */
 
 /*===========================================================================*/
diff --git a/modules/RT-STM32L476RG-NUCLEO64/module.c b/modules/RT-STM32L476RG-NUCLEO64/module.c
index f4b800a..5bc228e 100644
--- a/modules/RT-STM32L476RG-NUCLEO64/module.c
+++ b/modules/RT-STM32L476RG-NUCLEO64/module.c
@@ -521,6 +521,7 @@ ROMCONST char* moduleShellPrompt = "PowerManagement";
 
 /** @} */
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /*===========================================================================*/
 /**
  * @name Startup Shutdown Synchronization Protocol (SSSP)
@@ -529,6 +530,7 @@ ROMCONST char* moduleShellPrompt = "PowerManagement";
 /*===========================================================================*/
 
 /** @} */
+#endif
 
 /*===========================================================================*/
 /**
diff --git a/modules/RT-STM32L476RG-NUCLEO64/module.h b/modules/RT-STM32L476RG-NUCLEO64/module.h
index 3cf3a65..db6954c 100644
--- a/modules/RT-STM32L476RG-NUCLEO64/module.h
+++ b/modules/RT-STM32L476RG-NUCLEO64/module.h
@@ -333,7 +333,7 @@ extern ROMCONST apalControlGpio_t moduleGpioChargeEn2;
 /**
  * @brief   Event flag to be set on a SYS_SYNC interrupt.
  */
-//#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << GPIOC_SYS_INT_N)
+#define MODULE_OS_IOEVENTFLAGS_SYSSYNC          ((eventflags_t)1 << GPIOC_SYS_INT_N)
 
 /**
  * @brief   Event flag to be set on a SYS_PD interrupt.
@@ -461,6 +461,7 @@ extern ROMCONST char* moduleShellPrompt;
 
 /** @} */
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /*===========================================================================*/
 /**
  * @name Startup Shutdown Synchronization Protocol (SSSP)
@@ -510,6 +511,8 @@ extern ROMCONST char* moduleShellPrompt;
 
 /** @} */
 
+#endif
+
 /*===========================================================================*/
 /**
  * @name Low-level drivers
diff --git a/unittests/periphery-lld/module.h b/unittests/periphery-lld/module.h
index d6ba3e9..ed68d1f 100755
--- a/unittests/periphery-lld/module.h
+++ b/unittests/periphery-lld/module.h
@@ -253,6 +253,7 @@ extern const char* moduleShellPrompt;
 
 /** @} */
 
+#if (AMIROOS_CFG_SSSP_ENABLE == true)
 /*===========================================================================*/
 /**
  * @name Startup Shutdown Synchronization Protocol (SSSP)
@@ -292,6 +293,8 @@ extern const char* moduleShellPrompt;
 
 /** @} */
 
+#endif
+
 /*===========================================================================*/
 /**
  * @name Low-level drivers
