Explorar o código

CMSIS-DAP: MDK5 templates updated to latest V2.0.0/V1.2.0

Robert Rostohar %!s(int64=8) %!d(string=hai) anos
pai
achega
fae3bbe5db

+ 358 - 0
CMSIS/DAP/Firmware/Template/MDK5/USBD_User_CustomClass_0.c

@@ -0,0 +1,358 @@
+/*------------------------------------------------------------------------------
+ * MDK Middleware - Component ::USB:Device
+ * Copyright (c) 2004-2016 ARM Germany GmbH. All rights reserved.
+ *------------------------------------------------------------------------------
+ * Name:    USBD_User_CustomClass_0.c
+ * Purpose: USB Device Custom Class User module
+ * Rev.:    V6.7.3
+ *----------------------------------------------------------------------------*/
+/*
+ * USBD_User_CustomClass_0.c is a code template for the Custom Class 0 
+ * class request handling. It allows user to handle all Custom Class class 
+ * requests.
+ *
+ * Uncomment "Example code" lines to see example that receives data on 
+ * Endpoint 1 OUT and echoes it back on Endpoint 1 IN.
+ * To try the example you also have to enable Bulk Endpoint 1 IN/OUT in Custom 
+ * Class configuration in USBD_Config_CustomClass_0.h file.
+ */
+
+/**
+ * \addtogroup usbd_custom_classFunctions
+ *
+ */
+
+
+//! [code_USBD_User_CustomClass]
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include "cmsis_os2.h"
+#define   osObjectsExternal
+#include "osObjects.h"
+#include "rl_usb.h"
+#include "Driver_USBD.h"
+#include "DAP_config.h"
+#include "DAP.h"
+
+static volatile uint16_t USB_RequestIndexI;     // Request  Index In
+static volatile uint16_t USB_RequestIndexO;     // Request  Index Out
+static volatile uint16_t USB_RequestCountI;     // Request  Count In
+static volatile uint16_t USB_RequestCountO;     // Request  Count Out
+static volatile uint8_t  USB_RequestIdle;       // Request  Idle  Flag
+
+static volatile uint16_t USB_ResponseIndexI;    // Response Index In
+static volatile uint16_t USB_ResponseIndexO;    // Response Index Out
+static volatile uint16_t USB_ResponseCountI;    // Response Count In
+static volatile uint16_t USB_ResponseCountO;    // Response Count Out
+static volatile uint8_t  USB_ResponseIdle;      // Response Idle  Flag
+
+static uint8_t  USB_Request [DAP_PACKET_COUNT][DAP_PACKET_SIZE] __attribute__((section(".bss.USB_IO")));  // Request  Buffer
+static uint8_t  USB_Response[DAP_PACKET_COUNT][DAP_PACKET_SIZE] __attribute__((section(".bss.USB_IO")));  // Response Buffer
+static uint16_t USB_RespSize[DAP_PACKET_COUNT];                                                           // Response Size
+
+// \brief Callback function called during USBD_Initialize to initialize the USB Custom class instance
+void USBD_CustomClass0_Initialize (void) {
+  // Handle Custom Class Initialization
+
+  // Initialize variables
+  USB_RequestIndexI  = 0U;
+  USB_RequestIndexO  = 0U;
+  USB_RequestCountI  = 0U;
+  USB_RequestCountO  = 0U;
+  USB_RequestIdle    = 1U;
+  USB_ResponseIndexI = 0U;
+  USB_ResponseIndexO = 0U;
+  USB_ResponseCountI = 0U;
+  USB_ResponseCountO = 0U;
+  USB_ResponseIdle   = 1U;
+}
+
+// \brief Callback function called during USBD_Uninitialize to de-initialize the USB Custom class instance
+void USBD_CustomClass0_Uninitialize (void) {
+  // Handle Custom Class De-initialization
+}
+
+// \brief Callback function called upon USB Bus Reset signaling
+void USBD_CustomClass0_Reset (void) {
+  // Handle USB Bus Reset Event
+}
+
+// \brief Callback function called when Endpoint Start was requested (by activating interface or configuration)
+// \param[in]     ep_addr       endpoint address.
+void USBD_CustomClass0_EndpointStart (uint8_t ep_addr) {
+  // Start communication on Endpoint
+  if (ep_addr == USB_ENDPOINT_OUT(1U)) {
+    USB_RequestIdle = 0U;
+    USBD_EndpointRead(0U, USB_ENDPOINT_OUT(1U), USB_Request[0], DAP_PACKET_SIZE);
+  }
+}
+
+// \brief Callback function called when Endpoint Stop was requested (by de-activating interface or activating configuration 0)
+// \param[in]     ep_addr       endpoint address.
+void USBD_CustomClass0_EndpointStop (uint8_t ep_addr) {
+  // Handle Endpoint communication stopped
+  (void)ep_addr;
+}
+
+// \brief Callback function called when Custom Class 0 received SETUP PACKET on Control Endpoint 0
+//        (this callback will be called only for Class Requests (USB_REQUEST_CLASS) if it was not processed 
+//         previously by Device callback)
+// \param[in]     setup_packet            pointer to received setup packet.
+// \param[out]    buf                     pointer to data buffer used for data stage requested by setup packet.
+// \param[out]    len                     pointer to number of data bytes in data stage requested by setup packet.
+// \return        usbdRequestStatus       enumerator value indicating the function execution status
+// \return        usbdRequestNotProcessed:request was not processed; processing will be done by USB library
+// \return        usbdRequestOK:          request was processed successfully (send Zero-Length Packet if no data stage)
+// \return        usbdRequestStall:       request was processed but is not supported (stall Endpoint 0)
+usbdRequestStatus USBD_CustomClass0_Endpoint0_SetupPacketReceived (const USB_SETUP_PACKET *setup_packet, uint8_t **buf, uint32_t *len) {
+  (void)setup_packet;
+  (void)buf;
+  (void)len;
+
+  switch (setup_packet->bmRequestType.Recipient) {
+    case USB_REQUEST_TO_DEVICE:
+      break;
+    case USB_REQUEST_TO_INTERFACE:
+      break;
+    case USB_REQUEST_TO_ENDPOINT:
+      break;
+    default:
+      break;
+  }
+
+  return usbdRequestNotProcessed;
+}
+
+// \brief Callback function called when SETUP PACKET was processed by USB library
+//        (this callback will be called only for Class Requests (USB_REQUEST_CLASS) if it was not processed 
+//         previously by Device callback nor by Custom Class callback)
+// \param[in]     setup_packet            pointer to processed setup packet.
+void USBD_CustomClass0_Endpoint0_SetupPacketProcessed (const USB_SETUP_PACKET *setup_packet) {
+  (void)setup_packet;
+
+  switch (setup_packet->bmRequestType.Recipient) {
+    case USB_REQUEST_TO_DEVICE:
+      break;
+    case USB_REQUEST_TO_INTERFACE:
+      break;
+    case USB_REQUEST_TO_ENDPOINT:
+      break;
+    default:
+      break;
+  }
+}
+
+// \brief Callback function called when Custom Class 0 received OUT DATA on Control Endpoint 0
+//        (this callback will be called only for Class Requests (USB_REQUEST_CLASS) if it was not processed 
+//         previously by Device callback)
+// \param[in]     len                     number of received data bytes.
+// \return        usbdRequestStatus       enumerator value indicating the function execution status
+// \return        usbdRequestNotProcessed:request was not processed; processing will be done by USB library
+// \return        usbdRequestOK:          request was processed successfully (send Zero-Length Packet)
+// \return        usbdRequestStall:       request was processed but is not supported (stall Endpoint 0)
+// \return        usbdRequestNAK:         request was processed but the device is busy (return NAK)
+usbdRequestStatus USBD_CustomClass0_Endpoint0_OutDataReceived (uint32_t len) {
+  (void)len;
+  return usbdRequestNotProcessed;
+}
+
+// \brief Callback function called when Custom Class 0 sent IN DATA on Control Endpoint 0
+//        (this callback will be called only for Class Requests (USB_REQUEST_CLASS) if it was not processed 
+//         previously by Device callback)
+// \param[in]     len                     number of sent data bytes.
+// \return        usbdRequestStatus       enumerator value indicating the function execution status
+// \return        usbdRequestNotProcessed:request was not processed; processing will be done by USB library
+// \return        usbdRequestOK:          request was processed successfully (return ACK)
+// \return        usbdRequestStall:       request was processed but is not supported (stall Endpoint 0)
+// \return        usbdRequestNAK:         request was processed but the device is busy (return NAK)
+usbdRequestStatus USBD_CustomClass0_Endpoint0_InDataSent (uint32_t len) {
+  (void)len;
+  return usbdRequestNotProcessed;
+}
+
+// \brief Callback function called when DATA was sent or received on Endpoint n
+// \param[in]     event                   event on Endpoint:
+//                                          - ARM_USBD_EVENT_OUT = data OUT received
+//                                          - ARM_USBD_EVENT_IN  = data IN  sent
+void USBD_CustomClass0_Endpoint1_Event  (uint32_t event) {
+  // Handle Endpoint 1 events
+  uint32_t n;
+
+  if (event & ARM_USBD_EVENT_OUT) {
+    n = USBD_EndpointReadGetResult(0U, USB_ENDPOINT_OUT(1U));
+    if (n != 0U) {
+      if (USB_Request[USB_RequestIndexI][0] == ID_DAP_TransferAbort) {
+        DAP_TransferAbort = 1U;
+      } else {
+        USB_RequestIndexI++;
+        if (USB_RequestIndexI == DAP_PACKET_COUNT) {
+          USB_RequestIndexI = 0U;
+        }
+        USB_RequestCountI++;
+        osThreadFlagsSet(DAP_ThreadId, 0x01);
+      }
+    }
+    // Start reception of next request packet
+    if ((uint16_t)(USB_RequestCountI - USB_RequestCountO) != DAP_PACKET_COUNT) {
+      USBD_EndpointRead(0U, USB_ENDPOINT_OUT(1U), USB_Request[USB_RequestIndexI], DAP_PACKET_SIZE);
+    } else {
+      USB_RequestIdle = 1U;
+    }
+  }
+  if (event & ARM_USBD_EVENT_IN) {
+    if (USB_ResponseCountI != USB_ResponseCountO) {
+      // Load data from response buffer to be sent back
+      USBD_EndpointWrite(0U, USB_ENDPOINT_IN(1U), USB_Response[USB_ResponseIndexO], USB_RespSize[USB_ResponseIndexO]);
+      USB_ResponseIndexO++;
+      if (USB_ResponseIndexO == DAP_PACKET_COUNT) {
+        USB_ResponseIndexO = 0U;
+      }
+      USB_ResponseCountO++;
+    } else {
+      USB_ResponseIdle = 1U;
+    }
+  }
+}
+void USBD_CustomClass0_Endpoint2_Event  (uint32_t event) {
+  // Handle Endpoint 2 events
+  if (event & ARM_USBD_EVENT_IN) {
+    SWO_TransferComplete();
+  }
+}
+void USBD_CustomClass0_Endpoint3_Event  (uint32_t event) {
+  // Handle Endpoint 3 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint4_Event  (uint32_t event) {
+  // Handle Endpoint 4 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint5_Event  (uint32_t event) {
+  // Handle Endpoint 5 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint6_Event  (uint32_t event) {
+  // Handle Endpoint 6 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint7_Event  (uint32_t event) {
+  // Handle Endpoint 7 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint8_Event  (uint32_t event) {
+  // Handle Endpoint 8 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint9_Event  (uint32_t event) {
+  // Handle Endpoint 9 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint10_Event (uint32_t event) {
+  // Handle Endpoint 10 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint11_Event (uint32_t event) {
+  // Handle Endpoint 11 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint12_Event (uint32_t event) {
+  // Handle Endpoint 12 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint13_Event (uint32_t event) {
+  // Handle Endpoint 13 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint14_Event (uint32_t event) {
+  // Handle Endpoint 14 events
+  (void)event;
+}
+void USBD_CustomClass0_Endpoint15_Event (uint32_t event) {
+  // Handle Endpoint 15 events
+  (void)event;
+}
+
+// DAP Thread.
+__NO_RETURN void DAP_Thread (void *argument) {
+  uint32_t flags;
+  uint32_t n;
+  (void)   argument;
+
+  for (;;) {
+    osThreadFlagsWait(0x81U, osFlagsWaitAny, osWaitForever);
+
+    // Process pending requests
+    while (USB_RequestCountI != USB_RequestCountO) {
+
+      // Handle Queue Commands
+      n = USB_RequestIndexO;
+      while (USB_Request[n][0] == ID_DAP_QueueCommands) {
+        USB_Request[n][0] = ID_DAP_ExecuteCommands;
+        n++;
+        if (n == DAP_PACKET_COUNT) {
+          n = 0U;
+        }
+        if (n == USB_RequestIndexI) {
+          flags = osThreadFlagsWait(0x81U, osFlagsWaitAny, osWaitForever);
+          if (flags & 0x80U) {
+            break;
+          }
+        }
+      }
+
+      // Execute DAP Command (process request and prepare response)
+      USB_RespSize[USB_ResponseIndexI] =
+        (uint16_t)DAP_ExecuteCommand(USB_Request[USB_RequestIndexO], USB_Response[USB_ResponseIndexI]);
+
+      // Update Request Index and Count
+      USB_RequestIndexO++;
+      if (USB_RequestIndexO == DAP_PACKET_COUNT) {
+        USB_RequestIndexO = 0U;
+      }
+      USB_RequestCountO++;
+
+      if (USB_RequestIdle) {
+        if ((uint16_t)(USB_RequestCountI - USB_RequestCountO) != DAP_PACKET_COUNT) {
+          USB_RequestIdle = 0U;
+          USBD_EndpointRead(0U, USB_ENDPOINT_OUT(1U), USB_Request[USB_RequestIndexI], DAP_PACKET_SIZE);
+        }
+      }
+
+      // Update Response Index and Count
+      USB_ResponseIndexI++;
+      if (USB_ResponseIndexI == DAP_PACKET_COUNT) {
+        USB_ResponseIndexI = 0U;
+      }
+      USB_ResponseCountI++;
+
+      if (USB_ResponseIdle) {
+        if (USB_ResponseCountI != USB_ResponseCountO) {
+          // Load data from response buffer to be sent back
+          n = USB_ResponseIndexO++;
+          if (USB_ResponseIndexO == DAP_PACKET_COUNT) {
+            USB_ResponseIndexO = 0U;
+          }
+          USB_ResponseCountO++;
+          USB_ResponseIdle = 0U;
+          USBD_EndpointWrite(0U, USB_ENDPOINT_IN(1U), USB_Response[n], USB_RespSize[n]);
+        }
+      }
+    }
+  }
+}
+
+// SWO Data Queue Transfer
+//   buf:    pointer to buffer with data
+//   num:    number of bytes to transfer
+void SWO_QueueTransfer (uint8_t *buf, uint32_t num) {
+  USBD_EndpointWrite(0U, USB_ENDPOINT_IN(5U), buf, num);
+}
+
+// SWO Data Abort Transfer
+void SWO_AbortTransfer (void) {
+  USBD_EndpointAbort(0U, USB_ENDPOINT_IN(5U));
+}
+
+//! [code_USBD_User_CustomClass]

+ 34 - 25
CMSIS/DAP/Firmware/Template/MDK5/USBD_User_HID_0.c

@@ -1,10 +1,10 @@
 /*------------------------------------------------------------------------------
  * MDK Middleware - Component ::USB:Device
- * Copyright (c) 2004-2014 ARM Germany GmbH. All rights reserved.
+ * Copyright (c) 2004-2017 ARM Germany GmbH. All rights reserved.
  *------------------------------------------------------------------------------
  * Name:    USBD_User_HID_0.c
  * Purpose: USB Device Human Interface Device class (HID) User module
- * Rev.:    V6.2
+ * Rev.:    V6.2.3
  *----------------------------------------------------------------------------*/
 /**
  * \addtogroup usbd_hidFunctions
@@ -39,12 +39,13 @@
 
 //! [code_USBD_User_HID]
 
+#include <stdint.h>
 #include <string.h>
+#include "cmsis_os2.h"
 #define   osObjectsExternal
-#include "cmsis_os.h"
 #include "osObjects.h"
 #include "rl_usb.h"
-#include "USB\USBD_Config_HID_0.h"
+#include "RTE\USB\USBD_Config_HID_0.h"
 #include "DAP_config.h"
 #include "DAP.h"
 
@@ -56,22 +57,22 @@
 #error "USB HID Input Report Size must match DAP Packet Size"
 #endif
 
-static uint16_t USB_RequestIndexI;      // Request  Index In
-static uint16_t USB_RequestIndexO;      // Request  Index Out
-static uint16_t USB_RequestCountI;      // Request  Count In
-static uint16_t USB_RequestCountO;      // Request  Count Out
+static volatile uint16_t USB_RequestIndexI;     // Request  Index In
+static volatile uint16_t USB_RequestIndexO;     // Request  Index Out
+static volatile uint16_t USB_RequestCountI;     // Request  Count In
+static volatile uint16_t USB_RequestCountO;     // Request  Count Out
 
-static uint16_t USB_ResponseIndexI;     // Response Index In
-static uint16_t USB_ResponseIndexO;     // Response Index Out
-static uint16_t USB_ResponseCountI;     // Response Count In
-static uint16_t USB_ResponseCountO;     // Response Count Out
-static uint8_t  USB_ResponseIdle;       // Response Idle  Flag
+static volatile uint16_t USB_ResponseIndexI;    // Response Index In
+static volatile uint16_t USB_ResponseIndexO;    // Response Index Out
+static volatile uint16_t USB_ResponseCountI;    // Response Count In
+static volatile uint16_t USB_ResponseCountO;    // Response Count Out
+static volatile uint8_t  USB_ResponseIdle;      // Response Idle  Flag
 
 static uint8_t  USB_Request [DAP_PACKET_COUNT][DAP_PACKET_SIZE];  // Request  Buffer
 static uint8_t  USB_Response[DAP_PACKET_COUNT][DAP_PACKET_SIZE];  // Response Buffer
 
 
-// Called during USBD_Initialize to initialize the USB Device class.
+// Called during USBD_Initialize to initialize the USB HID class instance.
 void USBD_HID0_Initialize (void) {
   // Initialize variables
   USB_RequestIndexI  = 0U;
@@ -86,7 +87,7 @@ void USBD_HID0_Initialize (void) {
 }
 
 
-// Called during USBD_Uninitialize to de-initialize the USB Device class.
+// Called during USBD_Uninitialize to de-initialize the USB HID class instance.
 void USBD_HID0_Uninitialize (void) {
 }
 
@@ -105,6 +106,7 @@ void USBD_HID0_Uninitialize (void) {
 //              - value >= 0: number of report data bytes prepared to send
 //              - value = -1: invalid report requested
 int32_t USBD_HID0_GetReport (uint8_t rtype, uint8_t req, uint8_t rid, uint8_t *buf) {
+  (void)rid;
 
   switch (rtype) {
     case HID_REPORT_INPUT:
@@ -148,26 +150,30 @@ int32_t USBD_HID0_GetReport (uint8_t rtype, uint8_t req, uint8_t rid, uint8_t *b
 // \return      true    received report data processed.
 // \return      false   received report data not processed or request not supported.
 bool USBD_HID0_SetReport (uint8_t rtype, uint8_t req, uint8_t rid, const uint8_t *buf, int32_t len) {
+  (void)req;
+  (void)rid;
 
   switch (rtype) {
     case HID_REPORT_OUTPUT:
-      if (len == 0) { break; }
+      if (len == 0) {
+        break;
+      }
       if (buf[0] == ID_DAP_TransferAbort) {
         DAP_TransferAbort = 1U;
         break;
       }
       if ((uint16_t)(USB_RequestCountI - USB_RequestCountO) == DAP_PACKET_COUNT) {
-        osSignalSet(HID0_ThreadId, 0x80);
+        osThreadFlagsSet(DAP_ThreadId, 0x80U);
         break;  // Discard packet when buffer is full
       }
       // Store received data into request buffer
-      memcpy(USB_Request[USB_RequestIndexI], buf, len);
+      memcpy(USB_Request[USB_RequestIndexI], buf, (uint32_t)len);
       USB_RequestIndexI++;
       if (USB_RequestIndexI == DAP_PACKET_COUNT) {
         USB_RequestIndexI = 0U;
       }
       USB_RequestCountI++;
-      osSignalSet(HID0_ThreadId, 0x01);
+      osThreadFlagsSet(DAP_ThreadId, 0x01U);
       break;
     case HID_REPORT_FEATURE:
       break;
@@ -176,13 +182,14 @@ bool USBD_HID0_SetReport (uint8_t rtype, uint8_t req, uint8_t rid, const uint8_t
 }
 
 
-// HID0 Thread.
-void HID0_Thread (void const *arg) {
-  osEvent  evt;
+// DAP Thread.
+__NO_RETURN void DAP_Thread (void *argument) {
+  uint32_t flags;
   uint32_t n;
+  (void)   argument;
 
   for (;;) {
-    osSignalWait(0, osWaitForever);
+    osThreadFlagsWait(0x81U, osFlagsWaitAny, osWaitForever);
 
     // Process pending requests
     while (USB_RequestCountI != USB_RequestCountO) {
@@ -196,8 +203,10 @@ void HID0_Thread (void const *arg) {
           n = 0U;
         }
         if (n == USB_RequestIndexI) {
-          evt = osSignalWait(0, osWaitForever);
-          if (evt.value.signals & 0x80) { break; }
+          flags = osThreadFlagsWait(0x81U, osFlagsWaitAny, osWaitForever);
+          if (flags & 0x80U) {
+            break;
+          }
         }
       }
 

+ 27 - 11
CMSIS/DAP/Firmware/Template/MDK5/main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
+ * Copyright (c) 2013-2017 ARM Limited. All rights reserved.
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -17,22 +17,23 @@
  *
  * ----------------------------------------------------------------------
  *
- * $Date:        20. May 2015
- * $Revision:    V1.10
+ * $Date:        1. December 2017
+ * $Revision:    V2.0.0
  *
  * Project:      CMSIS-DAP Template MDK5
- * Title:        main.c RTX CMSIS-DAP Main module
+ * Title:        main.c CMSIS-DAP Main module
  *
  *---------------------------------------------------------------------------*/
 
-#include "cmsis_os.h"
+#include "cmsis_os2.h"
 #include "osObjects.h"
 #include "rl_usb.h"
 #include "DAP_config.h"
 #include "DAP.h"
 
-// Main program
-int main (void) {
+// Application Main program
+__NO_RETURN void app_main (void *argument) {
+  (void)argument;
 
   DAP_Setup();                          // DAP Setup 
 
@@ -47,9 +48,24 @@ int main (void) {
   LED_RUNNING_OUT(0U);                  // Turn off Target Running LED
   LED_CONNECTED_OUT(0U);                // Turn off Debugger Connected LED
 
-  // Create HID Thread
-  HID0_ThreadId = osThreadCreate(osThread(HID0_Thread), NULL);
+  // Create DAP Thread
+  DAP_ThreadId = osThreadNew(DAP_Thread, NULL, NULL);
+
+  // Create SWO Thread
+  SWO_ThreadId = osThreadNew(SWO_Thread, NULL, NULL);
+
+  osDelay(osWaitForever);
+  for (;;) {};
+}
+
+int main (void) {
+
+  SystemCoreClockUpdate();
+  osKernelInitialize();                 // Initialize CMSIS-RTOS
+  osThreadNew(app_main, NULL, NULL);    // Create application main thread
+  if (osKernelGetState() == osKernelReady) {
+    osKernelStart();                    // Start thread execution
+  }
 
-  osThreadSetPriority(osThreadGetId(), osPriorityIdle);
-  for (;;);                             // Endless Loop
+  for (;;) {};
 }

+ 15 - 9
CMSIS/DAP/Firmware/Template/MDK5/osObjects.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
+ * Copyright (c) 2013-2017 ARM Limited. All rights reserved.
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -17,26 +17,32 @@
  *
  * ----------------------------------------------------------------------
  *
- * $Date:        20. May 2015
- * $Revision:    V1.10
+ * $Date:        1. December 2017
+ * $Revision:    V2.0.0
  *
  * Project:      CMSIS-DAP Template MDK5
- * Title:        osObjects.h CMSIS-DAP RTOS Objects
+ * Title:        osObjects.h CMSIS-DAP RTOS2 Objects
  *
  *---------------------------------------------------------------------------*/
 
 #ifndef __osObjects_h__
 #define __osObjects_h__
 
-#include "cmsis_os.h"
+#include "cmsis_os2.h"
 
 #ifdef osObjectsExternal
-extern osThreadId HID0_ThreadId;
+extern osThreadId_t DAP_ThreadId;
+extern osThreadId_t SWO_ThreadId;
 #else
-       osThreadId HID0_ThreadId;
+extern osThreadId_t DAP_ThreadId;
+       osThreadId_t DAP_ThreadId;
+extern osThreadId_t SWO_ThreadId;
+       osThreadId_t SWO_ThreadId;
 #endif
 
-extern void HID0_Thread (void const *arg);
-osThreadDef(HID0_Thread, osPriorityNormal, 1U, 512U);
+extern void DAP_Thread (void *argument);
+extern void SWO_Thread (void *argument);
+
+extern void app_main (void *argument);
 
 #endif  /* __osObjects_h__ */