Stand-Alone Target Setup

Before You Start

Standalone mode combines the target application with the kernel and boots them together on the target PC from the hard drive (or, alternatively, flash memory). The host PC does not need to be connected to the target PC.

Before you start, set up your system as described.

  1. Create a standard boot disk or network boot image for serial or network communication (depending on your configuration). You will need to do this so that you can copy your Standalone mode files to the target PC. See Serial Communication, Network Communication, Booting Target PCs from Boot Floppy Disk, and xPC Target Boot Options in the Installation and Configuration chapter of the xPC Target Getting Started Guide.

  2. Boot the target PC.

  3. Ensure that your target PC hard drive is a serial ATA (SATA) or parallel ATA (PATA)/Integrated Device Electronics (IDE) drive, configured as a primary master. The xPC Target product supports file systems of type FAT-12, FAT-16, or FAT-32. Ensure that the hard drive is not cable-selected and that the BIOS can detect it.

After you create the stand-alone target application files, you will copy them to the target PC hard drive using the File Transfer Protocol (FTP) functions of the xPC Target file system. You do not need to be familiar with the xPC Target file system before you start, but for further information on this feature, see Working with Target PC Files and File Systems.

Updating Environment Properties

The xPC Target software uses the environment properties to determine what files to create for the various target boot modes.

This procedure assumes you have serial or network communication working correctly between your host computer and a target PC.

  1. On the host computer, start the MATLAB interface.

  2. In the MATLAB window, type

    xpcexplr

    The xPC Target Explorer window opens.

  3. In the xPC Target Explorer xPC Target Hierarchy pane, select a target PC Configuration node.

  4. Click the Standalone tab.

The xPC Target software updates the environment properties, and the build process is ready to create a stand-alone kernel/target application. See Creating a Kernel/Target Application. For Standalone mode, you do not create an xPC Target boot disk or network boot image. Instead, you copy files created from the build process to the target PC hard drive.

Creating a Kernel/Target Application

Use the xPC Target software with Standalone mode to create a combined kernel and target application with utility files. A combined kernel and target application allows you to disconnect your target PC from a host PC and run stand-alone applications.

After you set the Simulink and Real-Time Workshop parameters for code generation with the xPC Target software in your Simulink model, you can use the xPC Target software with Standalone mode to create a target application:

  1. In the MATLAB window, type the name of a Simulink model. For example, type

    xpc_osc3

    A Simulink window opens with the model.

  2. From the Tools menu, point to Real-Time Workshop, and then click Build Model.

    Real-Time Workshop and xPC Target software create a directory xpc_osc3_xpc_emb with the following files:

Refer to Copying the Kernel/Target Application to the Target PC Flash Disk for a description of how to transfer these files to the target PC.

Copying the Kernel/Target Application to the Target PC Flash Disk

You build a target application on a host PC using the Real-Time Workshop and xPC Target products, and a C/C++ compiler. One method for transferring the files from the host PC to a target PC is to use the FTP functions of the xPC Target file system.

After you build a stand-alone application on a host PC, you can copy files from the host PC to the target PC hard drive or flash disk. If you have not already created the necessary files, see Creating a Kernel/Target Application.

  1. Ensure that your target PC is still booted from a target PC boot disk.

  2. In the MATLAB Command Window, change directory on the host computer to the directory that contains the kernel/target application files.

  3. Create the directory C:\xpcfiles and copy files to that directory. For example, type

    f=xpctarget.ftp
    f.mkdir('xpcfiles')
    f.cd('xpcfiles')
    f.put('autoexec.bat')
    f.put('xpcboot.com')
    f.put('xpc_osc3.rtb')
  4. If you want your stand-alone application to run when you reboot your target PC, remove the 3.5-inch disk or CD from the target PC, reboot the target PC, and bring up the DOS prompt. For example, if you see the message for selecting the operating system to start, select Microsoft Windows.

    The boot process is stopped and a DOS prompt is displayed.

  5. At the DOS prompt, save a copy of the target PC file C:\autoexec.bat to a backup file, such as C:\autoexec_back.wrk.

  6. Edit the target PC file C:\autoexec.bat to include the following lines. Adding these commands to C:\autoexec.bat directs the system to execute the autoexec.bat file located in C:\xpcfiles.

    cd C:\xpcfiles
    autoexec

  7. Reboot the target PC.

  8. The sequence of calls during the boot process is

    1. C:\autoexec.bat

    2. C:\xpcfiles\autoexec.bat

    3. C:\xpcfiles\xpcboot.com

    4. C:\xpcfiles\<application>.rtb

The stand-alone target application should now be running on the target PC.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS