Using the µVision Socket Interface  Application Note 198
Control and monitor µVision via the built-in TCP/IP interface
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Direct Interface (UVSOCK)

The UVSOCK interface can be used directly, although this is recommended only for cases where the Client Interface (UVSC) cannot be used, for example, when the client runs on an operating system other than Microsoft Windows.

The UVSOCK reference is avaialble in UVSOCK Interface (UVSOCK.h). Refer also to UVSOCK Messaging. Predefined data types are described in UVSOCK Data Types.

Follow these steps when working with UVSOCK:

All possible operations are listed in UV_OPERATION.

Enable UVSOCK in uVision

A.) Configure the TCP server port directly in uVision:

  1. Select the menu Edit –> Configuration –> Other
  2. Enable UVSOCK (TCP/IP) Settings
  3. Set server Port, for example, to 4823.
uvsock_tcpip_settings.png
UVSOCK Configuration

B.) Alternatively, configure the TCP server port manually:

  1. Open the file TOOLS.INI from the installation folder of uVision (by default, C:\Keil_v5)
  2. In the section [UV2] set the value for the entry SOCKETPORT. Setting SOCKETPORT to 0, disables the interface.

Example

[UV2]
...
SOCKETPORT=4823 // =0 - disabled
...

Configure a project

Configuring a project is the process of opening a uVision project and adding files to project groups. Complex configuration of a project is possible via the uVision IDE. To configure a project:

Build a project

Building a project is the process of compiling and assembling source files, and linking the resultant object files to create an executable image. To build a project:

Debug a project

Debugging a project is the process of monitoring program execution. There are several methods of debugging:

  • Static Debugging - halt execution before inspecting the state.
  • Real-Time Debugging - inspect the state while target is executing. Real-Time Debugging is possible in uVision via the Real-Time Agent.

Static Debugging

Inspect the application state when execution has been halted. Follow these steps for static debugging:

Real-Time Debugging

Inspect the application state while the target is executing. Follow these steps for real-time debugging:

To communicate with the target via a serial interface, use any UART or the Real-Time Agent Terminal in simulation or target mode:

To exit debugging mode:

Accessing Event Recorder Data

Event Recorder shows the dynamic behavior of software components that helps you to analyze the internal operation. Using the UVSOCK interface, it is possible to gain access to the Event Recorder data:

  • Register to receive Event Records:
    UV_DBG_EVTR_REGISTER = 0x2035 // Register to receive the Event Recorder Data
    // Request format: no data
    // Response format: #UVSOCK_CMD_RESPONSE --> no data / #UVSOCK_ERROR_RESPONSE
  • Unregister to receive Event Records:
    UV_DBG_EVTR_UNREGISTER = 0x2036 // Unregister to not receive the data sent from Event Recorder anymore
    // Request format: no data
    // Response format: #UVSOCK_CMD_RESPONSE --> no data / #UVSOCK_ERROR_RESPONSE
  • Check the current Event Recorder status:
    UV_DBG_EVTR_GETSTATUS = 0x2037 // Status of Event Recorder
    // Request format: no data
    // Response format #UVSOCK_CMD_RESPONSE --> no data / #UVSOCK_ERROR_RESPONSE
  • Get the list of active SCVD files:
    UV_DBG_EVTR_ENUMSCVDFILES = 0x2038 // Get SCVD files
    // Request format: no data
    // Response format: #UVSOCK_CMD_RESPONSE --> no data / #UVSOCK_ERROR_RESPONSE

The interface will answer with these responses to the requests:

  • Response to registering events:
    UV_DBG_EVTR_OUTPUT = 0x5063 // Notification of Event Recorder Data
    // Async format : #EVTROUT
  • Response to requesting SCVD files:
    UV_DBG_EVTR_ENUMSCVDFILES_START = 0x5064, // Start of available view enumeration
    // Async format : no data
    UV_DBG_EVTR_ENUMSCVDFILES_ENU = 0x5065, // View list enumeration; one or more Response(s) with view item information
    // Async format : #UVSOCK_CMD_RESPONSE --> #SSTR / #UVSOCK_ERROR_RESPONSE
    UV_DBG_EVTR_ENUMSCVDFILES_END = 0x5066, // End of task list enumeration
    // Async format : no data