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/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) {
