Off-Target Environment

From STRIDE Wiki
Revision as of 23:48, 3 June 2009 by Timd (talk | contribs)
Jump to navigation Jump to search

Overview

The STRIDE SDK is provided to be used primarily as an off-target evaluation or development sandbox. This allows you to use STRIDE in a small, controlled environment without needing to make changes to your target build. In addition, the SDK Makefile can serve as an example of the steps needed to add STRIDE instrumentation to your target build.

Each SDK package has identical functionality, but targets a specific operating system. The SDK contains the following items:

  • STRIDE runtime source
  • PAL source for interface with the Target OS
  • Makefile to build STRIDE runtime library, test and sample applications
  • Compiler setting file for target processor

Evaluation Steps

To simplify the evalution, we recommend using a single Windows or Linux computer for both the target and host systems. Host and target code will run in separate processes and communicate via TCP/IP, thus simulating an embedded target with host computer configuration. All code and techniques used in the sandbox evaluation are directly transferrable to a production environment.

The recommended evaluation steps are as follows:

  1. Build the STRIDE runtime library
  2. Build and connect to the target app with only the runtime
  3. Build and test the target app with S2 diagnostic tests
  4. Build and test the target app with the TestIntro sample

Building the STRIDE Runtime Library

Note: all Makefiles must be run with gnu make. For SDKs targeting OS's where this is not the standard make utility, an executable is supplied in the SDK's bin directory.

Linux

The Makefile assumes a gnu toolchain. (Other toolchains can be used; see the comments in the Makefile.)

  1. cd to ~/stride/SDK/Linux/src
  2. Build the library
    make library
    
  3. The file ~/stride/SDK/Linux/out/lib/libstride.a will be produced

Windows

The Makefile assumes a Visual Studio toolchain. (Other toolchains can be used; see the comments in the Makefile.)

  1. If using Microsoft Visual Studio, open a Visual Studio command prompt to ensure that the compiler and linker are on your PATH.[1]
  2. cd to stride\SDK\Windows\src
  3. build the library using the supplied gnu make. (You will get Makefile errors if you use the default make.)
    ..\bin\make library
    
  4. The file stride\SDK\Windows\out\lib\stride.lib will be produced

Building the TargetApp

This step builds the first version of an instrumented target application. This application links with the STRIDE runtime library and adds the S2 diagnostic tests.

This step requires an installation of the STRIDE build tools. If not installed, please see Package Installation for more information.

Linux

  1. cd to ~/stride/SDK/Linux/src
  2. Build the test app
    make testapp
    
  3. The file ~/stride/SDK/Linux/out/bin/TestApp will be produced
  4. Note also that the STRIDE database file ~/stride/SDK/Linux/out/TestApp.sidb is also produced

Windows

  1. If using Microsoft Visual Studio, open a Visual Studio command prompt to ensure that the compiler and linker are on your PATH.
  2. cd to stride\SDK\Windows\src
  3. build the test app using the supplied gnu make. (You will get Makefile errors if you use the default make.)
    ..\bin\make testapp
    
  4. The file stride\SDK\Windows\out\bin\TestApp.exe will be produced
  5. Note also that the STRIDE database file stride\SDK\Linux\out\TestApp.sidb is also produced

SDK Target Application Details

Verifying Host to Target Connectivity

In this step, we will use the stride executable to verify connectivity between host and target.

This step requires an installation of the STRIDE host tools. If not installed, please see Package Installation for more information.

  1. Invoke the TestApp.
    • Windows: TestApp.exe will open and run in a new console window
    • Linux: In order to see TestApp's output, we recommend that you manually open a new console and invoke TestApp from there
  2. Note TestApp's output upon startup. Under Linux, the following is shown
    [tim@s2centos01 bin]$ ./TestApp
     starting up...
     "_srThread" thread started.
     "stride" thread started.
     Listening on TCP port 8000
    
  3. From a console window, invoke stride as follows, to verify connectivity with the target app:
    stride --diagnostic --device TCP:localhost:8000
  4. View the output on

Adding Diagnostic Tests

Adding Sample Tests

Makefile Targets

all
Builds the library target
library
Builds STRIDE runtime, producing stride.lib
clean
Deletes intermediate and target files
testapp
Builds an instrumented test application, TestApp.exe, using sources found in the sample_src directory
database
im
daemon

Instrumenting Multiple Processes

Notes

  1. You can get a VS command prompt via the Start menu. Choose: Start -> All Programs -> Microsoft Visual Studio 200X -> Visual Studio Tools -> Visual Studio 200X Command Prompt