Products & Services Solutions Academia Support User Community Company

Learn more about xPC Target   

DOSLoader Target Setup

Introduction

DOSLoader mode allows you to copy the xPC Target kernel to the target flash disk, remove the disk drive, and then boot the xPC Target kernel. Alternatively, you can also boot the xPC Target kernel from the target PC 3.5 inch disk drive. The target application is still downloaded from the host PC. Use this mode for applications where an xPC Target host is not easily accessible.

Updating Environment Properties and Creating a Boot Disk

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. It is helpful to successfully create a target application with the Boot Floppy, CD Boot, or Network Boot tabs before trying to create a kernel that boots from DOS.

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

  2. In the MATLAB Command 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. In the configuration pane, select DOS Loader.

  5. In the Location field, enter or browse to the directory to contain the xPC Target files. By default, the directory is current working directory.

  6. Click Apply.

  7. Click Create DOS Loader.

    If you entered a floppy drive (for example, a:) , the software copies the DOSLoader files to the 3.5-inch disk.

  8. If you entered a floppy drive for the Location field, insert a 3.5-inch disk, and then click OK.

    Regardless of the Location entry, the files xpcsgo.rtb (serial) or xpctgo.rtb (TCP/IP), xpcboot.com, and autoexec.bat are created.

    If you enter a floppy drive, these files are written to the 3.5-inch disk. If you enter a local directory other than a floppy drive, the software creates these files in that directory.

    With DOSLoader mode, the correct *.rtb file is created according to the options specified in the following table.

    xPC Target Environment

    HostTargetComm: RS-232

    HostTargetComm: TCP/IP

    TargetScope: Disabled

    xpcsto.rtb

    xpctto.rtb

    TargetScope: Enabled

    xpcsgo.rtb

    xpctgo.rtb

      Note   Some target PCs might not boot if you try to boot them with a boot disk configured for DOSLoader mode and a maximum model size of 16 MB. If you encounter this problem, create a new boot disk with a different configuration, for example DOSLoader mode and a maximum model size of 1 MB or 4 MB.

    Note that the autoexec.bat file should contain at least the following line:

    xpcboot xxx.rtb

    where xxx.rtb is the file described in the table above. Inspect this autoexec.bat file to confirm this.

  9. If you want to boot the target PC from the 3.5-inch disk,

    1. Remove the 3.5-inch disk from the host PC.

    2. Put that disk into the target PC disk drive.

    3. Reboot the target PC. The DOS is booted from the target boot disk and the autoexec.bat files, resulting in the automatic execution of the xPC Target loader. From this point onward, the CPU runs in protected mode and DOS is discarded.

Otherwise, if you want to boot the target PC from flash memory instead of the 3.5-inch disk, see Copying the Kernel to Flash Memory for a description of how to copy the kernel to flash memory. The same procedure works with flash disks and other boot devices.

Copying the Kernel to Flash Memory

One method for transferring the kernel files from a host PC to a target PC is to use an external 3.5-inch disk drive or CD disk drive.

After you create a disk with the kernel files on a host PC, you can copy the kernel files from the 3.5-inch disk or CD to the flash disk. See Updating Environment Properties and Creating a Boot Disk.

  1. If there is a 3.5-inch disk or CD, remove it. On the target PC, press the Reset button.

  2. Boot into the DOS prompt. For example, you can create a DOS disk and boot the target PC off this disk.

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

  3. Insert the 3.5-inch disk or CD with the xPC Target kernel into the target PC external disk drive.

  4. Create a directory to contain the xPC Target files. For example, type

    mkdir C:\xpcfiles
  5. Copy files to C:\xpcfiles. For example, type

    copy A:\xpcsgo.rtb C:\xpcfiles
    copy A:\xpcboot.com C:\xpcfiles
    copy A:\autoexec.bat C:\xpcfiles
  6. If you want the kernel to run when you press the Reset button on your target PC, save a copy of the file C:\autoexec.bat to a backup file, such as C:\autoexec_back.wrk.

  7. Edit the file C:\autoexec.bat to include the following lines. Adding these commands to C:\autoexec.bat directs the system to load the kernel from C:\xpcfiles.

    cd C:\xpcfiles
    xpcboot xpcsgo.rtb

      Note   The file C:\autoexec.bat includes the files you want the system to execute when the system starts up.

  8. Remove the disk, and then, on the target PC, press the Reset button.

Creating a Target Application for DOSLoader Mode

For DOSLoader mode, a target application is created on a host PC and downloaded to your target PC.

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 environment with DOSLoader 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.

The Real-Time Workshop and xPC Target products create a target application and download it to your target.

Creating DOSLoader Files with a Command-Line Interface

You use DOSLoader files to load and run the xPC Target kernel. After you make changes to the xPC Target environment properties, you need to create or update the kernel (DOSLoader files).

To create DOSLoader files for the current xPC Target environment, use the following procedure:

  1. In the MATLAB window, type

    getxpcenv
  2. Ensure that the following xPC Target properties are set as follows:

    • TargetBootDOSLOader

    • DOSLoaderLocation — Your host PC DOSLoader files location

  3. If these properties are not set with the correct values, use the setxpcenv function to set them. For example

    setxpcenv('TargetBoot','DOSLoader')
    setxpcenv(DOSLoaderLocation,'c:\work\xpc\dosloader')
    updatexpcenv
  4. In the MATLAB window, type

    xpcbootdisk

    The xPC Target software displays the following message and creates the DOSLoader files.

    Current boot mode: DOSLoader
    xPC Target DOS Loader files are successfully created
  5. Transfer the DOSLoader files as described in Copying the Kernel to Flash Memory.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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