commit f7d2c7865d7b8e739703522e37d290c5bef68193
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Fri Mar 8 11:00:23 2019 +0100

    Version increased to 1.2.x beta:
    - Introduced module IDs for new AMiRo 1.2 modules.
    - Introduced a new secondary wakeup reason (IMU) which is analogous to ACCEL.
    - Setting a BOOT_COM_DEVICE_LEGACY_ID is now optional, since the ne wmodules will operate only with the new ID scheme.
    - Fixed some typos.

diff --git a/Target/Modules/DiWheelDrive_1-1/Boot/iodef.h b/Target/Modules/DiWheelDrive_1-1/Boot/iodef.h
index cea5008..5961a8a 100644
--- a/Target/Modules/DiWheelDrive_1-1/Boot/iodef.h
+++ b/Target/Modules/DiWheelDrive_1-1/Boot/iodef.h
@@ -55,7 +55,7 @@
 #define IR_SDA_PIN          GPIO_Pin_11
 #define IR_INT_GPIO         GPIOB
 #define IR_INT_PIN          GPIO_Pin_12
-#define GYRP_DRDY_GPIO      GPIOB
+#define GYRO_DRDY_GPIO      GPIOB
 #define GYRO_DRDY_PIN       GPIO_Pin_13
 #define SYS_UART_UP_GPIO    GPIOB
 #define SYS_UART_UP_PIN     GPIO_Pin_14
diff --git a/Target/Modules/DiWheelDrive_1-1/Boot/main.c b/Target/Modules/DiWheelDrive_1-1/Boot/main.c
index ad7b433..6cfc70a 100644
--- a/Target/Modules/DiWheelDrive_1-1/Boot/main.c
+++ b/Target/Modules/DiWheelDrive_1-1/Boot/main.c
@@ -78,7 +78,7 @@ void blCallbackHandleShutdownRequest(void);
 
 const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
   .magicNumber = BL_MAGIC_NUMBER,
-  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 2},
+  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
   .vSSSP = {BL_VERSION_ID_SSSP, BL_SSSP_VERSION_MAJOR, BL_SSSP_VERSION_MINOR, 0},
   .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
   .cbShutdownHibernate = blCallbackShutdownHibernate,
@@ -95,7 +95,6 @@ const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) =
   .cb11 = (void*)0
 };
 
-
 /************************************************************************************//**
 ** \brief     This is the entry point for the bootloader application and is called
 **            by the reset interrupt vector after the C-startup routines executed.
@@ -174,7 +173,7 @@ int main(void)
     status = handleColdReset();
   }
 
-  /* if something wehnt wrong, signal this failure */
+  /* if something went wrong, signal this failure */
   if (status != SUCCESS) {
     blinkSOSinf();
   }
@@ -392,7 +391,7 @@ static void initExti() {
   GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource15); // ACCEL_INT_N
 
   return;
-}
+} /*** end of initExti ***/
 
 /*
  * Signals, which type of low-power mode the system shall enter after the shutdown sequence.
@@ -483,7 +482,7 @@ void shutdownToTransportation(const blt_bool exec_disambiguation) {
 } /*** end of shutdownToTransportation ***/
 
 /*
- * Final shutdown of the system to enter deepseleep mode.
+ * Final shutdown of the system to enter deepsleep mode.
  */
 void shutdownToDeepsleep(const blt_bool exec_disambiguation) {
   /* configure some criticpal GPIOs as input
diff --git a/Target/Modules/LightRing_1-0/Boot/blt_conf.h b/Target/Modules/LightRing_1-0/Boot/blt_conf.h
index 7753e4b..ee538ba 100644
--- a/Target/Modules/LightRing_1-0/Boot/blt_conf.h
+++ b/Target/Modules/LightRing_1-0/Boot/blt_conf.h
@@ -116,7 +116,6 @@
 /** \brief Configure legacy device ID. */
 #define BOOT_COM_DEVICE_LEGACY_ID       (0x3)
 
-
 /* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE
  * configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed
  * in bits/second. The maximum amount of data bytes in a message for data transmission
diff --git a/Target/Modules/LightRing_1-0/Boot/main.c b/Target/Modules/LightRing_1-0/Boot/main.c
index 923e79e..76ac105 100644
--- a/Target/Modules/LightRing_1-0/Boot/main.c
+++ b/Target/Modules/LightRing_1-0/Boot/main.c
@@ -75,7 +75,7 @@ void blCallbackHandleShutdownRequest(void);
 
 const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
   .magicNumber = BL_MAGIC_NUMBER,
-  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 2},
+  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
   .vSSSP = {BL_VERSION_ID_SSSP, BL_SSSP_VERSION_MAJOR, BL_SSSP_VERSION_MINOR, 0},
   .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
   .cbShutdownHibernate = blCallbackShutdownHibernate,
@@ -103,7 +103,7 @@ int main(void)
   /* initialize the microcontroller */
   Init();
 
-  /* activate some required cocks */
+  /* activate some required clocks */
   RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
   RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD, ENABLE);
 
@@ -133,7 +133,7 @@ int main(void)
 
   setLed(BLT_FALSE);
 
-  /* hanlde different wakeup/reset reasons */
+  /* handle different wakeup/reset reasons */
   ErrorStatus status = ERROR;
   if (backup_reg.wakeup_pri_reason & BL_WAKEUP_PRI_RSN_PINRST) {
     /* system was woken via NRST pin */
@@ -533,7 +533,7 @@ void shutdownAndRestart(const blt_bool exec_disambiguation) {
    */
 
   return;
-}
+} /*** end of shutdownAndRestart***/
 
 /*
  * Configures some GPIO pins as inputs for safety reasons.
diff --git a/Target/Modules/PowerManagement_1-1/Boot/main.c b/Target/Modules/PowerManagement_1-1/Boot/main.c
index f33ea77..bae9f75 100644
--- a/Target/Modules/PowerManagement_1-1/Boot/main.c
+++ b/Target/Modules/PowerManagement_1-1/Boot/main.c
@@ -88,7 +88,7 @@ void blCallbackHandleShutdownRequest(void);
 
 const blCallbackTable_t cbtable __attribute__ ((section ("_callback_table"))) = {
   .magicNumber = BL_MAGIC_NUMBER,
-  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Release, BL_VERSION_MAJOR, BL_VERSION_MINOR, 2},
+  .vBootloader = {BL_VERSION_ID_AMiRoBLT_Beta, BL_VERSION_MAJOR, BL_VERSION_MINOR, 0},
   .vSSSP = {BL_VERSION_ID_SSSP, BL_SSSP_VERSION_MAJOR, BL_SSSP_VERSION_MINOR, 0},
   .vCompiler = {BL_VERSION_ID_GCC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__},  // currently only GCC is supported
   .cbShutdownHibernate = blCallbackShutdownHibernate,
diff --git a/Target/Modules/moduleids.mk b/Target/Modules/moduleids.mk
index 3ee120c..649c3e2 100644
--- a/Target/Modules/moduleids.mk
+++ b/Target/Modules/moduleids.mk
@@ -28,11 +28,23 @@
 DiWheelDrive_1-1_ID_HEX = 0x01000101
 DiWheelDrive_1-1_ID_DEC = 16777473
 
-# PowerManagement v1.1 (01:01:01:01)
-PowerManagement_1-1_ID_HEX = 0x01010101
-PowerManagement_1-1_ID_DEC = 16843009
+# DiWheelDrive v1.2 (01:00:01:02)
+DiWheelDrive_1-2_ID_HEX = 0x01000102
+DiWheelDrive_1-2_ID_DEC = 16777474
 
 # LightRing v1.0 (01:7F:01:00)
 LightRing_1-0_ID_HEX = 0x017F0100
 LightRing_1-0_ID_DEC = 25100544
 
+# LightRing v1.2 (01:7F:01:02)
+LightRing_1-0_ID_HEX = 0x017F0102
+LightRing_1-0_ID_DEC = 25100546
+
+# PowerManagement v1.1 (01:01:01:01)
+PowerManagement_1-1_ID_HEX = 0x01010101
+PowerManagement_1-1_ID_DEC = 16843009
+
+# PowerManagement v1.2 (01:01:01:02)
+PowerManagement_1-2_ID_HEX = 0x01010102
+PowerManagement_1-2_ID_DEC = 16843010
+
diff --git a/Target/Source/AMiRo/amiroblt.h b/Target/Source/AMiRo/amiroblt.h
index 6081022..3385ca4 100644
--- a/Target/Source/AMiRo/amiroblt.h
+++ b/Target/Source/AMiRo/amiroblt.h
@@ -50,7 +50,7 @@
 /**
  * @brief   The minor version number of the bootloader.
  */
-#define BL_VERSION_MINOR                          1
+#define BL_VERSION_MINOR                          2
 
 /**
  * @brief   The major version number of the implemented SSSP (Startup & Shutdown Synchronization Protocol).
@@ -343,6 +343,11 @@ enum blWakeupReason_t {
   BL_WAKEUP_SEC_RSN_ACCEL      = 0x20u,
 
   /**
+   * @brief The WKUP pin was triggered by an interrupt from the IMU.
+   */
+  BL_WAKEUP_SEC_RSN_IMU        = 0x20u,
+
+  /**
    * @brief Reserved value that must not be used right now, but might become valid in a future version.
    */
   BL_WAKEUP_SEC_RSN_RSVD       = 0xC0u,
diff --git a/Target/Source/ARMCM3_STM32/can.c b/Target/Source/ARMCM3_STM32/can.c
index c5da070..865e921 100644
--- a/Target/Source/ARMCM3_STM32/can.c
+++ b/Target/Source/ARMCM3_STM32/can.c
@@ -525,11 +525,20 @@ blt_int8u CanReceivePacket(blt_int8u *data)
                               (((blt_int32u)canData[1]) <<  8) | \
                               (((blt_int32u)canData[0]));
 #if (BOOT_GATE_ENABLE > 0)
+#if defined(BOOT_COM_DEVICE_LEGACY_ID)
         if ((commandSend == BLT_TRUE && deviceID == 0) ||
-            (commandSend != BLT_TRUE && (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID) || deviceID == (blt_int32u)BOOT_COM_DEVICE_LEGACY_ID)) {
+            (commandSend != BLT_TRUE && (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID || deviceID == (blt_int32u)BOOT_COM_DEVICE_LEGACY_ID))) {
 #else
+        if ((commandSend == BLT_TRUE && deviceID == 0) ||
+            (commandSend != BLT_TRUE && (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID))) {
+#endif
+#else
+#if defined(BOOT_COM_DEVICE_LEGACY_ID)
         if (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID ||
             deviceID == (blt_int32u)BOOT_COM_DEVICE_LEGACY_ID) {
+#else
+        if (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID) {
+#endif
 #endif
           /* store length of the packet */
           toReceive = canData[4];
diff --git a/Target/Source/ARMCM4_STM32/can.c b/Target/Source/ARMCM4_STM32/can.c
index 901603f..48a39d7 100644
--- a/Target/Source/ARMCM4_STM32/can.c
+++ b/Target/Source/ARMCM4_STM32/can.c
@@ -601,8 +601,13 @@ blt_int8u CanReceivePacket(blt_int8u *data)
                               (((blt_int32u)canData[1]) <<  8) | \
                               (((blt_int32u)canData[0]));
 #if (BOOT_GATE_ENABLE > 0)
+#if defined(BOOT_COM_DEVICE_LEGACY_ID)
         if ((commandSend == BLT_TRUE && deviceID == 0) ||
-            (commandSend != BLT_TRUE && (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID) || deviceID == (blt_int32u)BOOT_COM_DEVICE_LEGACY_ID)) {
+            (commandSend != BLT_TRUE && (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID || deviceID == (blt_int32u)BOOT_COM_DEVICE_LEGACY_ID))) {
+#else
+        if ((commandSend == BLT_TRUE && deviceID == 0) ||
+            (commandSend != BLT_TRUE && (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID))) {
+#endif
 #else
         if (deviceID == (blt_int32u)BOOT_COM_DEVICE_ID) {
 #endif
diff --git a/Target/Source/xcp.c b/Target/Source/xcp.c
index a6190d9..bc036f0 100644
--- a/Target/Source/xcp.c
+++ b/Target/Source/xcp.c
@@ -714,9 +714,14 @@ static void XcpCmdConnect(blt_int8u *data, blt_int16s dataLength)
   }
   /* indicate that the connection is established */
 #if (BOOT_GATE_ENABLE > 0)
+#if defined(BOOT_COM_DEVICE_LEGACY_ID)
   if (deviceID == 0 ||
       deviceID == (blt_int32u)BOOT_COM_DEVICE_ID ||
       deviceID == (blt_int32u)BOOT_COM_DEVICE_LEGACY_ID) {
+#else
+  if (deviceID == 0 ||
+      deviceID == (blt_int32u)BOOT_COM_DEVICE_ID) {
+#endif
 #endif
     xcpInfo.connected = 1;
     setLed(1);
