3 pSOSystem Tutorial for PCs


This chapter helps you gain experience with the pSOSystem environment. The tutorial in this chapter tells you how to build, download, and run an executable image. The executable image contains a sample application called hello. The hello sample program resembles the Hello World program familiar to most programmers; hello prints a short message and exits.

The tutorial in this chapter requires a PC running Windows 3.0 or later. For other PC system requirements, see the pRISM Environment for Windows document. For a workstation-based pSOSystem tutorial, refer to Chapter 3, ``pSOSystem Tutorial for PCs."

By following the examples in this chapter, you can learn how to perform the following tasks:

3.1 Recommended Software and Hardware

This chapter contains explanations and commands you can execute with the following hardware and software:

The examples in this tutorial have target hardware dependencies. To accommodate these dependencies, the pSOSystem environment includes fully operable board-support packages (BSPs) for the CPU boards described in Appendix B, ``Board-Specific Information." This chapter is based on the use of these supported boards because:

If your target is not a supported board, you should try to obtain a supported board for temporary use. The supported boards are widely available, but if you cannot obtain one, you could read this chapter and then proceed to Chapter 7, ``Understanding and Developing Board-Support Packages."

3.2 Setting Up a Working Directory

Before you begin this tutorial, you should create your own copy of the hello sample application code in a working directory. To do this, start the pRISM command-line interpreter by clicking the command-line icon, as shown in Figure 3-1.

Figure 3-1 pRISM Command-Line Interpreter

Once you start the pRISM interpreter, you are working in a window that emulates a UNIX environment, similar to the window shown in Figure 3-2.

Figure 3-2 Interpreter Window

From the pRISM command-line prompt, enter the following commands:

mkdir c:/workdir
cd c:/workdir
cp c:/psos/apps/hello* .

where workdir is the name of a working directory created with the mkdir command and psos is the directory where pSOSystem is loaded.

You can enter forward or backward slashes from an interpreter window. The interpreter correctly converts them for DOS as needed.

The working directory contains the following files:

readme drv_conf.c sys_conf.h

default.bld root.c userapp.bld

3.2.1 Specifying Your Board-Support Package

The file default.bld provides information to the pRISM builder for building the executable image. Before you start the pRISM Integrated Development Environment (IDE), you must edit default.bld and change it to specify the BSP you plan to use. (This chapter introduces the pRISM editor, but you can use any standard text editor.) In default.bld, locate the following line:

:target=PSS_BSP/psosmips.bld

and substitute the full pathname of the BSP you plan to use for PSS_BSP. For example, if the board is an IDT 79S465 and the pSOSystem root directory is c:/usr/psosmips, change the line to:

:target=/usr/psosmips/bsps/idt79S465/psosmips.bld

3.2.2 Configuring SpOTLIGHT

If you plan to use SpOTLIGHT, you can make an additional change to the default.bld file. Locate the following line:

:remote=spotlight -c TARGET_STRING

If you are using serial communication, change the line to:

:remote=spotlight -c s[device]

where device is the device name of the serial channel you use to communicate with the target system. For example:

s/dev/ttya

If you are using Ethernet with User Datagram Protocol (UDP), change the line to:

:remote=spotlight -c u[target]

where target is the host name or the IP address of the target system. For example:

u199.19.199.19

You can also use the pRISM Integrated Development Environment (IDE) to configure the SpOTLIGHT debugger as described in the following sections and in the SpOTLIGHT Debug Server User's Manual.

3.3 Invoking the pRISM IDE

The pRISM IDE is an integrated development environment where you can edit source files and build, download, and debug pSOSystem executable images. For detailed information on the pRISM IDE and SpOTLIGHT debugger, refer to the pRISM Integrated Development Environment User's Guide and the SpOTLIGHT Debug Server User's Manual.

Start the pRISM IDE from within the working directory you just created:

multi &

The pRISM Builder window appears on your screen, as shown in Figure 3-3.

Figure 3-3 pRISM Builder Window

3.4 Examining the root.c File

The root.c file contains the code for the hello program's ROOT task. This code prints a message to the console or SpOTLIGHT In/Out window, then suspends itself, causing the IDLE task to run indefinitely. This section contains directions for examining root.c. To examine root.c, click once on the Edit button in the pRISM Builder window. A file selection window appears as in Figure 3-4.

Figure 3-4 Edit File Selector Window

Next, double-click on root.c (scroll to it if necessary) to select it. The file selection window closes, and the pRISM editor window appears as shown in Figure 3-5.

Figure 3-5 pRISM Editor

The pRISM editor window includes a scroll bar on its left side. You can use the scroll bar or [PgUp] and [PgDn] on the keyboard to move around the root.c file.

The source code in root.c illustrates some of the basic elements of constructing pSOSystem application code. As you examine the contents of root.c, note the following:

You can click the pRISM Editor's Done button to remove the window from your screen.

3.5 Building an Executable Image

If your system has the pSOS+m multiprocessor kernel, you must edit the sys_conf.h file before you build the executable image. You can start the pRISM Editor for this by selecting the Edit button in the pRISM Builder window. In the sys_conf.h file, search for the following lines:

#define      SC_PSOS         YES
#define      SC_PSOSM        NO

Change these lines to show YES for the pSOS+m kernel, SC_PSOSM, and NO for the pSOS+ kernel, SC_PSOS.

You now proceed to build the executable image. In the pRISM Builder window, select the Build button. A progress window subsequently displays messages while each module compiles. The final message Build completed should appear to indicate that the executable image has finished building.

The executable image contains the hello sample application and a version of pSOSystem for the selected hardware.

After the build completes, verify that it created the following files:

If any errors occurred during the build process, first check to see if you performed the copy commands correctly. If you did, then the installed pRISM tools may contain a problem. If you cannot locate the problem, contact Integrated Systems Technical Support.

3.6 Downloading the Executable Image

To run the executable image you created in the previous section, you must first download it to the target system. This section describes the download process.

The examples in this chapter depend on the use of the pSOSystem Boot ROMs, although the pSOSystem software does not require them. The Boot ROMs rely on the pROBE+ debugger for loading and other services, as described in Chapter 1, ``Introduction to the pSOSystem Environment." Boot ROMs can operate the pROBE+ debugger in the following modes:

This chapter demonstrates each mode. Integrated Systems recommends you perform all the exercises or at least read all the sections.

3.6.1 Starting the Boot ROMs

The target board must connect to an ASCII terminal through an RS-232 connection. A terminal emulation program running on the host is preferable to a ASCII terminal because, with a terminal emulator, you can use the same channel to download. If a target board has more than one RS-232 port, refer to Appendix B, ``Board-Specific Information," to determine which port to use.

Set the terminal or emulator characteristics to the following:

When you power up or reset the board, the terminal should display a pSOSystem startup message similar to the one in Figure 3-6.

pSOSystem V2.1.3
Copyright (c) 1991-1996, Integrated Systems, Inc.
----------------------------------------------------------------------------
STARTUP MODE:
	Boot into pROBE+ standalone mode
NETWORK INTERFACE PARAMETERS:
	LAN interface is disabled
	Shared memory interface is disabled
MULTIPROCESSING PARAMETERS:
	This board is currently configured as a single processor system
HARDWARE PARAMETERS:
	Serial channels will use a baud rate of 9600
	This board's memory will reside at 0x10000000 on the VME bus
	After the board is reset, startup code will wait 60 seconds
---------------------------------------------------------------------------
To change any of this, press any key within 60 seconds 

Figure 3-6 pSOSystem Startup Message

If a message like the one in Figure 3-6 does not appear, check for the following:

If the ROMs still do not operate, contact Integrated Systems Technical Support.

The message in Figure 3-6 shows the default ROM configuration parameters. After the startup message appears, the ROMs wait 60 seconds for keyboard input. If you do not enter a character within this period, the ROMs proceed to operate with the current configuration.

The startup mode in Figure 3-6 shows that the pROBE+ debugger mode is standalone, and the startup code has a wait period of 60 seconds. Use this mode and the 60-second wait for now. After the wait period is over, a message similar to the following indicates that the ROM-PROBE+ debugger is waiting for input:

pROBE+/MIPS PS V3.0.5.b
pROBE+/MIPS CE V3.0.5.b
pROBE+/MIPS RD V3.0.5.b
pROBE+/MIPS QS V3.0.5.b
pROBE+/MIPS DI V3.0.5.b

pROBE+>

You can now use ROM-pROBE+ to download the S-record file that contains the executable image ram.hex. The next section explains how.

For additional information about the ROMs, see Appendix B, ``Board-Specific Information."

3.6.2 Downloading the Executable Image ram.hex

To download the S-record file that contains the executable image, first enter the pROBE+ dl command, as follows:

pROBE+> dl

Next, enter the commands necessary to cause the terminal emulation program to transmit ram.hex over the serial channel. For example, on a Windows 3.x host you can take the following steps:

  1. Open the Windows Accessories group.
  2. Select the Terminal program.
  3. Select Send Text File from the Transfers menu.
  4. Specify the ram.hex file with the appropriate path.

If the download is successful, the pROBE+ debugger should display a message similar to the following (the number of records may vary):

9840 records read
pROBE+>

Often, the terminal emulation program misses part or all of this message. If so, you can obtain the results of the most recent download by entering the pROBE+ dl command again with the prev option, as follows:

pROBE+> dl prev
9840 records read

3.6.3 Starting the Executable Image

The pROBE+ go command begins or continues execution. When you enter go with the start address, the executable image is started by passing control to its start address. The start address is the image's load address + 4. To determine the start address for an individual board, see Appendix B, ``Board-Specific Information."

Once you have the board's start address, enter the command with the start address, as in the following example:

pROBE+> go 80060000

A message similar to the following appears:

pROBE+/MIPS PS V3.0.5.b
pROBE+/MIPS CE V3.0.5.b
pROBE+/MIPS QS V3.0.5.b
pROBE+/MIPS DI V3.0.5.b

pROBE+>

The RBUG (RD) module does not display after you download the executable image.

This is the point at which the hello sample program can run. Although this message may look similar to the one that appeared when the Boot ROMs started, the message comes from the downloaded pROBE+ debugger rather than the ROM-PROBE+ debugger. The ROM-PROBE+ debugger is no longer functioning and can regain control only if you reset the board.

Like the ROM-PROBE+ debugger, the downloaded pROBE+ debugger is running in standalone mode. If the setting for the parameter SE_DEBUG_MODE in sys_conf.h is STORAGE, the downloaded pROBE+ debugger operates in the same mode as the ROM-PROBE+ debugger. This is the default and is usually the most convenient approach. However, the ROM and downloaded pROBE+ debuggers do not need to operate in the same mode. If SE_DEBUG_MODE is set to either DBG_SA, DBG_XS, or DBG_XN, the downloaded debugger operates in the mode specified by the SE_DEBUG_MODE setting regardless of the ROM-PROBE+ operating mode.

3.6.4 Executing the hello Sample Program

The pROBE+ gs (Go Start) command passes control to pSOS+ startup. pSOS+ startup initializes the pSOS+ kernel and any other software components, and then returns control to the pROBE+ debugger. Enter the gs command from the pROBE+ prompt:

pROBE+> gs

The register contents appear as shown in Figure 3-7.

pROBE+>  gs

Kernel Event Break	                                                     Running: `ROOT'  -#00020000
-------------------------------------------------------------------------------------------------------------------------------
pSOS Initialized Event
R0/ZERO	=00000000 R1/AT	=00000000 R2/V0	=00000000 R3/V1	=00000000
R4/A0	=00000000 R5/A1	=00000000 R6/A2	=00000000 R7/A3	=00000000
R8/T0	=00000000 R9/T1	=00000000 R10/T2	=00000000 R11/T3	=00000000
R12/T4	=00000000 R13/T5	=00000000 R14/T6	=00000000 R15/T7	=00000000
R16/S0	=00000000 R17/S1	=00000000 R18/S2	=00000000 R19/S3	=00000000
R20/S4	=00000000 R21/S5	=00000000 R22/S6	=00000000 R23/S7	=00000000
R24/T8	=00000000 R25/T9	=00000000 R26/K0	=806000E0 R27/K1	=DEADDEAD
R28/GP	=800629E0 R29/SP	=800FED08 R30/FP	=00000000 R31/RA	=DEADDEAD
MDHI	=00000000 MDLO	=00000000 SR	=0000FF01
IP 	=80032220:27BDFFC8         addiu                  sp,sp,FFFFFFC8
pROBE+>

Figure 3-7 Output of the pROBE+ GS Command

The pSOS+ kernel is now initialized, and execution of the ROOT task is pending. Because pSOS+ initialization has just finished, two tasks are in the system. You can verify this by entering the pROBE+ qt (Query Task) command:

pROBE+> qt

The task information displayed by the pROBE+ qt command is shown in Figure 3-8.

Name 	TID 	Prio 	Mode 	Status 	Susp? 	Parameters 	Ticks
-----------------------------------------------------------------------------------------------------------------------
`IDLE	-#00010000	00	0000	Ready
`ROOT'	-#00020000	E6 	0000 	Running

pROBE+>

Figure 3-8 Output of the pROBE+ QT Command

You can use the pROBE+ di (Disassemble Memory) command to examine the code that is ready to execute, as follows:

pROBE+> di

Figure 3-9 shows output from the di command starting at address 06E3C (actual output may vary).

pROBE+>	di
	80072270	27BDFFC8	addiu		sp,sp,FFFFFFC8
	80072274	AFBF0034	sw	ra,00000034(sp)
	80072278	AFB10014	sw	s1,00000014(sp)
	8007227C	AFB00010	sw 	s0,00000010(sp)
	80072280	27B00030	addiu		s0,sp,00000030
	80072284	02003021	move		a2,s0
	80072288	27B1002C	addiu		s1,sp,0000002C
	8007228C	02203821	move		a3,s1
	80072290	3C040002	lui 	a0,00000002
	80072294	3C018008	lui 	at,FFFF8008
	80072298	24219E8C	addiu		at,at,FFFF9E8C
	8007229C	00370821	addu		at,at,s7
	800722A0	0020F809	jalr 		ra,at ;  (ori    a1,zero,00000000)
	800722A4	34050000	ori 	a1,zero,00000000
	800722A8	02003021	move		a2,s0
	800722AC	02203821	move		a3,s1

pROBE+>

Figure 3-9 Output of the pROBE+ DI Command

As explained previously, the hello sample program's ROOT task prints a message on the console, and then suspends itself with a t_suspend() call. Once ROOT is suspended, control passes to the IDLE task because no other tasks are in the system.

The IDLE task executes indefinitely; therefore, returning control to the pROBE+ debugger when the ROOT task blocks is best. The pROBE+ debugger lets you define a break condition that is triggered when any task makes a specified pSOS+ service call. For example, define a breakpoint on t_suspend() by entering the db (Define Breakpoint) command with the following syntax:

pROBE+> db se q_send * *

Figure 3-10 shows the DB SE output after you define the breakpoint.

pROBE+> db se t_suspend * *

SERVICE_BREAK____SERVICE________BY_TASK____PARAMETER____
	0 	T_SUSPEND 	***ANY*** 	Task: ANY

----------------------------------------------------------------------------------------------------

Figure 3-10 Output of the DB SE Command

Now resume execution with the go (Start) command. Figure 3-11 shows the subsequent hello output.

pROBE+>  go
Hello, world

Service Break	 	Service:T_SUSPEND	Task: 00000000-#00020000
			Running: `ROOT' -#00020000
-------------------------------------------------------------------------------------------------------------------------------
tid	=00000000
R0/ZERO	=00000000 R1/AT	=800396D4 R2/V0	=800FEBF8 R3/V1	=800437EC
R4/A0	=00000000 R5/A1	=00000000 R6/A2	=00000000 R7/A3	=00000000
R8/T0	=00000000 R9/T1	=800572B0 R10/T2	=80043AE0 R11/T3	=80043AE0
R12/T4	=00000000 R13/T5	=00000000 R14/T6	=800FECC8 R15/T7	=800FECC4
R16/S0	=800FECC8 R17/S1	=800FECC4 R18/S2	=00000000 R19/S3	=00000000
R20/S4	=00000000 R21/S5	=00000000 R22/S6	=00000000 R23/S7	=00000000
R24/T8	=00000000 R25/T9	=800FECC8 R26/K0	=806000E0 R27/K1	=DEADDEAD
R28/GP	=800629E0 R29/SP	=800FEC78 R30/FP	=00000000 R31/RA	=800322C0
MDHI	=00000000 MDLO 	=00000000 SR 	=0000FF01
IP 	=80039FB0:0000000C 	syscall
pROBE+>

Figure 3-11 Output from the hello Sample Program

Note that ROOT is about to suspend itself.

You can restart the hello sample program without downloading again by entering the gs command. The terminal displays the gs output as shown in Figure 3-12.

pROBE+>  gs

Kernel Event Break	                                                     Running: `ROOT'  -#00020000
-------------------------------------------------------------------------------------------------------------------------------
pSOS Initialized Event
R0/ZERO	=00000000 R1/AT	=00000000 R2/V0	=00000000 R3/V1	=00000000
R4/A0	=00000000 R5/A1	=00000000 R6/A2	=00000000 R7/A3	=00000000
R8/T0	=00000000 R9/T1	=00000000 R10/T2	=00000000 R11/T3	=00000000
R12/T4	=00000000 R13/T5	=00000000 R14/T6	=00000000 R15/T7	=00000000
R16/S0	=00000000 R17/S1	=00000000 R18/S2	=00000000 R19/S3	=00000000
R20/S4	=00000000 R21/S5	=00000000 R22/S6	=00000000 R23/S7	=00000000
R24/T8	=00000000 R25/T9	=00000000 R26/K0	=806000E0 R27/K1	=DEADDEAD
R28/GP	=800629E0 R29/SP	=800FED08 R30/FP	=00000000 R31/RA	=DEADDEAD
MDHI	=00000000 MDLO	=00000000 SR	=0000FF01
IP 	=80032220:27BDFFC8         addiu                  sp,sp,FFFFFFC8
pROBE+>

Figure 3-12 Output of the GS Command

You can then continue by entering the go command. The sample go command output appears as in Figure 3-13. Note that gs did not clear the break condition on t_suspend(), so you did not need to re-enter the break command. In this example, the go command displays the same output as shown in Figure 3-11 on page 3-18.

pROBE+>  go
Hello, world

Service Break	 	Service:T_SUSPEND	Task: 00000000-#00020000
			Running: `ROOT'  -#00020000
-------------------------------------------------------------------------------------------------------------------------------
tid	=00000000
R0/ZERO	=00000000 R1/AT	=800396D4 R2/V0	=800FEBF8 R3/V1	=800437EC
R4/A0	=00000000 R5/A1	=00000000 R6/A2	=00000000 R7/A3	=00000000
R8/T0	=00000000 R9/T1	=800572B0 R10/T2	=80043AE0 R11/T3	=80043AE0
R12/T4	=00000000 R13/T5	=00000000 R14/T6	=800FECC8 R15/T7	=800FECC4
R16/S0	=800FECC8 R17/S1	=800FECC4 R18/S2	=00000000 R19/S3	=00000000
R20/S4	=00000000 R21/S5	=00000000 R22/S6	=00000000 R23/S7	=00000000
R24/T8	=00000000 R25/T9	=800FECC8 R26/K0	=806000E0 R27/K1	=DEADDEAD
R28/GP	=800629E0 R29/SP	=800FEC78 R30/FP	=00000000 R31/RA	=800322C0
MDHI	=00000000 MDLO 	=00000000 SR 	=0000FF01
IP 	=80039FB0:0000000C 	syscall
pROBE+>

Figure 3-13 Output of the GO Command

This concludes the hello demonstration with the ROM-PROBE+ debugger and downloaded pROBE+ debugger in standalone mode.

3.7 Using the SpOTLIGHT Debugger Over a Serial
Channel

This section describes how to run the hello sample program by using the SpOTLIGHT debug server connected to the target over a serial channel. In this section, both the ROM-PROBE+ debugger and downloaded pROBE+ debugger operate in remote mode communicating with the SpOTLIGHT debug server over a serial channel. As explained previously, the operating modes of the ROM-PROBE+ debugger and downloaded pROBE+ debugger do not need to be the same, but usually are.

3.7.1 Assigning the Serial Port

To assign a serial port, set the SC_RBUG_PORT variable in the sys_conf.h file to the port number you plan to use for debugging the target application using SpOTLIGHT. This setting should not be the same as the SC_APP_CONSOLE value.

Refer to Chapter 8, ``Configuration and Startup", for detailed descriptions of SC_RBUG_PORT and SC_APP_CONSOLE.

3.7.2 Changing the Printing Method

For both single-channel and multichannel boards, the directives in this section apply for changing the printing method.

Some of the boards the pSOSystem environment supports have only a single serial channel. If the communication between the SpOTLIGHT debug server and the pROBE+ debugger takes place on a single channel, then neither a pSOS+ serial driver nor the hello sample application can use the channel. To resolve this conflict, the pROBE+ debugger provides the service call db_output(). When called by the application code, db_output() sends text to the SpOTLIGHT In/Out window. To use db_output(), you first need to change a line in the root.c file. In root.c, look for the following:

#define OUTPUT_TO_DEBUGGER 0

The preceding line causes the ROOT task to use the standard pSOSystem device driver for output.

To configure the ROOT task to use db_output(), change the 0 to a 1 in the preceding definition, as follows:

#define OUTPUT_TO_DEBUGGER 1

When a system has a single serial channel, OUTPUT_TO_DEBUGGER must be 1. For this tutorial, change the preceding line as instructed, even if you have more than one serial channel.

3.7.3 Adding the pROBE+ RBUG Module

You now need to modify the sys_conf.h file with a text editor. Because debugging takes place from the Host debugger, the pSOSystem environment must include the pROBE+ RBUG module. To add this module to the downloaded system, change the following statement in the sys_conf.h file:

#define         SC_PROBE_DEBUG          NO
to 
#define         SC_PROBE_DEBUG          YES

3.7.4 Rebuilding the Executable Image

After you have made the changes described above, rebuild the executable image by clicking Build in the pRISM Builder.

3.7.5 Reconfiguring the ROMs for a Serial Channel

To reconfigure the ROMs so they communicate with the SpOTLIGHT debug server, reset the target CPU board, then enter a character before 60 seconds elapses. A message similar to the following appears:

(M)odify any of this or (C)ontinue? [m]

Enter an m. A message similar to the following should appear:

For each of the following questions, press <Return> to keep the value in braces, or you can enter a new value.
How should the board boot?
1. pROBE+ standalone mode
2. pROBE+ waiting for host debugger via serial
3. pROBE+ waiting for host debugger via network
4. Run the TFTP bootloader
which one do you want? [1]

To use the SpOTLIGHT debug server over a serial channel, enter a 2.

The remaining parameters do not need changing, so you can answer each of the remaining questions by pressing [Return] until the following question appears:

How long (in seconds) should CPU delay before starting up? [60]

Now that you understand how to use the ROMs after a reset, 60 seconds is unnecessarily long. Enter a more suitable value, such as 3. You then see a ROM startup display similar to the one in Figure 3-14.

STARTUP MODE:
	Boot into pROBE+ and wait for host debugger via a serial connection
NETWORK INTERFACE PARAMETERS:
	LAN interface is disabled
	Shared memory interface is disabled
MULTIPROCESSING PARAMETERS
	This board is currently configured as a single processor system
HARDWARE PARAMETERS:
	Serial channels will use a baud rate of 9600
	This board's memory will reside at 0x10000000 on the VME bus
	After the board is reset, startup code will wait 3 seconds
---------------------------------------------------------------------------
(M)odify any of this or (C)ontinue? [M] 

Figure 3-14 ROM Startup Display

Enter a c to continue.

If a terminal emulator is running, close it now because the next section requires the use of the SpOTLIGHT debug server, and this requires the use of the serial channel.

Resetting a board does not cause the ROMs to revert to their default configuration. Furthermore, configuration data is stored in battery-backed or nonvolatile RAM when available; therefore, powering down a board causes a return to default values only if the board lacks nonvolatile storage capability.

3.7.6 Connecting the pRISM IDE to the Target System

The pRISM IDE communicates with the target system through the SpOTLIGHT debug server, which oversees the target's communication. You load the SpOTLIGHT debug server through the pRISM Builder Window as shown in Figure 3-15.

Figure 3-15 Using the pRISM Builder to Invoke the SpOTLIGHT Debugger

To invoke the SpOTLIGHT debugger, do the following:

  1. In the Builder data entry box next to the Debug button, make sure the displayed filename is ram.elf. If ram.elf is not displayed, select ram.bld in the default.bld file. This puts ram.elf in the Debug field.
  2. Click the Debug button in the Builder window. The Main Debugger Window appears as shown in Figure 3-16 on page 3-26.
  3. In the Main Debugger Window (just above the buttons), type:
remote spotlight -c s[device]

where device is the device name of the serial channel (s) you use to communicate (-c) with the target system. For example, for COM1, you enter:

remote spotlight -c sCOM1

-or-

click the Remote button in the pRISM Builder window (if you have configured the SpOTLIGHT debug server as indicated in section 3.2.2 on page 3-5).

  1. Press [Return]. This connects the SpOTLIGHT debug server to the target. Three additional windows appear (Task Roster, In/Out, and Target).

For a detailed description of the SpOTLIGHT debug server and SpOTLIGHT debug client, refer to the SpOTLIGHT Debug Server User's Manual.

3.7.7 Downloading the Executable Image

Now that the pRISM IDE is communicating with the target system, you can load the executable image onto the target system. In the Main Debugger Window, shown in Figure 3-16 on page 3-26, enter the command load to begin downloading the executable image.

If you plan to use the SpOTLIGHT debug server over a serial channel often, refer to Section 3.10, ``Changing the Baud Rate," for a description of how to increase the baud rate beyond the default of 9600 baud.

Note the following:

Your next step is to pass control to the operating system in the executable image. The next section explains this process.

3.7.8 Starting the Downloaded Operating System

The SpOTLIGHT debug server has a special command called osboot to pass control to the operating system in the executable image. The osboot command causes the SpOTLIGHT debug server to do the following:

Enter the following command:

osboot

The osboot command uses the start address in the executable as the OS start address.

When you enter osboot in the source level debugger window, the following message appears after its execution finishes:

OSBOOT completed

This message indicates that the downloaded operating system has successfully started and the downloaded pROBE+ debugger has connected to the SpOTLIGHT debug server.

3.7.9 Executing the hello Sample Application

Start the pSOS+ kernel by entering the pSOS+ Go Start command:

gs

The gs command passes control to pSOS+ startup in the same way as the pROBE+ gs command. A message similar to the following should appear in the debugger command window:

pSOS+ initialized Running: 'ROOT' -#00020000

Note that the source code in root.c now appears in the SpOTLIGHT debugger window. The first source line of procedure root is highlighted to indicate that its execution is pending.

You can now request a break condition when the ROOT task makes a t_suspend() call. To do this with the SpOTLIGHT debugger, enter the following Define Service Breaks command in the debugger command window:

db se t_suspend * *

Output similar to that in Figure 3-17 appears in the command subwindow.

pSOS+ initialized Running: `ROOT' -#00020000
db se t_suspend * *

SERVICE_BREAK____SERVICE________BY_TASK____PARAMETER____
                      0                                  T_SUSPEND            ***ANY***                  Task: ANY

---------------------------------------------------------------------------------

Figure 3-17 Output of the DB SE Command

Now, run the application by clicking the go button. A message similar to the following appears:

Service breakpoint #0 Running: 'ROOT' -#00020000

Before this message appears, the SpOTLIGHT In/Out window should have displayed the message from the hello sample program:

Hello, world

This concludes the demonstration of the SpOTLIGHT debug server over a serial channel. If you want to experiment further, restart the hello sample program by entering the gs command.

3.8 Using the SpOTLIGHT Debug Server Over Ethernet

This section describes how to run the hello sample program by using the SpOTLIGHT debug server over an Ethernet connection. The exercises in this section require the pNA+ network manager and your host and target must both be physically connected to an Ethernet network.

3.8.1 Adding the pROBE+ RBUG Module

You now need to modify the sys_conf.h file with a text editor. Because debugging takes place from the Host debugger, the pSOSystem environment must include the pROBE+ RBUG module. To add this module to the downloaded system, change the following statement in the sys_conf.h file:

#define         SC_PROBE_DEBUG          NO
to
#define         SC_PROBE_DEBUG          YES

3.8.2 Adding the pNA+ Network Manager

Because communication takes place over Ethernet, the pSOSystem environment must include the pNA+ TCP/IP network manager. To add the pNA+ network manager to the downloaded system, change the following statement in sys_conf.h:

#define         SC_PNA  NO
to
#define         SC_PNA  YES

In sys_conf.h you could also change the pROBE+ operating mode to Remote Debugger Over a Network, add an Ethernet interface, and assign an IP address to the Ethernet interface. However, as long as SC_SD_PARAMETERS is set to STORAGE, the downloaded system uses the same settings as the pSOSystem ROMs, so you don't need to change these parameters in sys_conf.h. (Section 3.8.6, ``Reconfiguring the ROMs for Ethernet," describes changes to the ROM parameters.)

3.8.3 Configuring the Host

Before using an Ethernet connection, verify that your host has one of the supported TCP/IP networking packages installed. For more information, see the SpOTLIGHT Debug Server User's Manual.

3.8.4 Output Over Ethernet

Recall that when the pROBE+ debugger runs in standalone mode, the hello output goes to the standard pSOSystem console. When you connected the SpOTLIGHT debug server to the serial channel, you had to change the hello sample source code to use the db_output() routine. To do this, you changed OUTPUT_TO_DEBUGGER in root.c. Now that the SpOTLIGHT debug server is connected over Ethernet, either method of output works. To use the pSOSystem console driver, connect a terminal to the serial channel to see the output.

3.8.5 Rebuilding the Executable Image

Rebuild the executable image by selecting Build in the pRISM window.

3.8.6 Reconfiguring the ROMs for Ethernet

The steps in this section are done from an ASCII terminal regardless of the subsequent operating mode of the ROMs.

This section describes how to reconfigure the ROMs to communicate with a SpOTLIGHT debug server over Ethernet. To do so, reset the board and enter a character before the time limit expires, then enter an m to modify the configuration parameters.

When the following prompt appears, enter a 3:

How should the board boot?
1. pROBE+ standalone mode
2. pROBE+ waiting for host debugger via serial
3. pROBE+ waiting for host debugger via network
4. Run the TFTP bootloader
which one do you want? [2]

Entering a 3 causes a response similar to the following:

NETWORK INTERFACE PARAMETERS:
Do you want a LAN interface? [N] y

Enter a y (n applies to multiprocessor systems where some boards communicate through shared memory rather than Ethernet). The next prompt is similar to the following:

This board's LAN IP address? (0.0.0.0 = RARP)? [999.9.999.9]

Enter the IP address of the CPU board using standard dot notation for internet addresses (four numeric fields, each separated by a period).

Enter an n to the next questions unless your board is using a subnet mask (if you enter a y, you are prompted from the subnet mask):

Use a subnet mask for the LAN interface? [N]

Answer n to the next question because it enables the shared memory network features useful only in multiprocessor target systems:

Do you want a shared memory network interface? [N]

For information on the shared memory, see Chapter 6, ``Shared Memory MultiProcessing Tutorial."

The next question is:

Should there be a default gateway for packet routing? [N]

The usual answer is n unless the target and host systems are on different networks connected through a gateway. If you are not sure how to answer this, see your network administrator.

This concludes the ROM configuration steps for operation over a network. The final summary you see after answering all questions resembles the output shown in Figure 3-18.

STARTUP MODE:
	Boot into pROBE+ and wait for host debugger via a network connection
NETWORK INTERFACE PARAMETERS:
	IP address on LAN is 999.9.999.9
	Shared memory interface is disabled
MULTIPROCESSING PARAMETERS
	This board is currently configured as a single processor system
HARDWARE PARAMETERS:
	Serial channels will use a baud rate of 9600
	This board's memory will reside at 0x10000000 on the VME bus
	After the board is reset, startup code will wait 60 seconds
---------------------------------------------------------------------------
(M)odify any of this or (C)ontinue? [M] 

Figure 3-18 Summary of ROM Configuration

Enter c to continue. No pROBE+ prompt appears because the pROBE+ debugger is waiting for a connection from the SpOTLIGHT debug server over the network.

3.8.7 Invoking the SpOTLIGHT Debugger on the Host

Section 3.7, ``Using the SpOTLIGHT Debugger Over a Serial Channel," shows how to invoke the SpOTLIGHT debug server for use over a serial channel. Invoking the SpOTLIGHT debug server for use over Ethernet is similar except that you enter the following in the debugger command window:

remote spotlight -c u[target]

where -c is the SpOTLIGHT communications string option, u indicates Ethernet using User Datagram Protocol (UDP), and target is the host name or IP address of the target system.

-or-

replace TARGET_STRING in the default.bld file, as described in Section 3.2.2, ``Configuring SpOTLIGHT," with the following:

u[target]

where target is the host name or IP address of the target system and u indicates Ethernet over User Datagram Protocol (UDP).

From this point forward, the SpOTLIGHT debugger operates exactly as described in Section 3.7.8, ``Starting the Downloaded Operating System."

3.9 Further Investigation

The apps directory contains a number of sample applications other than hello. Chapter 5, ``SpOTLIGHT Debugger Tutorial for PCs," describes the SpOTLIGHT demo application. The remaining sample applications demonstrate various pSOSystem capabilities. Instructions for using the other sample applications appear in the README file in each sample application directory. For a detailed list of the contents, see Appendix A, ``pSOSystem Files and Directories."

3.10 Changing the Baud Rate

If you are using the SpOTLIGHT debug server over a serial channel, you may want to increase the baud rate of the channel. You can increase it to either 19200 or 38400 baud if the host and target both support the higher rate.

If you change the baud rate, you must change it in the following places:

remote spotlight -c sCOM1,19200





psos_support@isi.com

Copyright © 1996, Integrated Systems, Inc. All rights reserved.