• Aucun résultat trouvé

How to get the emulator ready for use and make a few simple measurements

The MC68020 and MC68030/EC030 emulators have many powerful features to help you debug and integrate target system software and hardware. The tutorial in this chapter will guide you through the steps of setting up the emulator and making a few basic measurements with the built-in demonstration (demo) program. The steps are a general guide to using the emulator, but you might not follow them every time that you use the emulator.

You can use the tutorial in a variety of ways. You may simply want to skim the material, then set up the emulator and use part 2 of this manual to learn about the different tasks you can do with the Terminal Interface, or you can work through the tutorial by following the instructions in each step. The first part of each step gives you some general information on the command or action. You can enter the commands given in the “Examples” part of each step to work through a measurement using the Terminal Interface.

The tutorial (and many examples throughout this book) uses a simple demo program. This program emulates a simple command interpreter. It has a one-byte input buffer for commands, and recognizes the ASCII characters “A” and “B.” All other values are considered invalid. When you input a command to the buffer, the program calls a subroutine that interprets the command and writes a corresponding message to an output buffer. In the tutorial examples, you will enter a command by modifying memory, then view the results in the output buffer.

To load and run the complete demo program, your emulation system must have at least 256K of emulation memory (obtained by installing at least one SRAM on the emulation probe. Refer to the Installation and Service Chapter at the end of this manual for instructions on how to install SRAM memory modules.

Step 1. Install the emulator and analyzer into the Card Cage

If you purchased the MC68020/68030/EC030 emulator as a complete system, the emulator and analyzer boards are preinstalled in the HP 64700 Card Cage at HP.

However, if you purchased the MC68020/68030/EC030 emulator and analyzer boards separately, you must install them in the HP 64700 Card Cage before you can use the emulator.

• Install the emulator and analyzer boards according to the instructions in Chapter 15 of this manual.

If you have any questions regarding the installation that are not answered by the instructions in Chapter 15, see the HP 64700 Series Card Cage Installation/Service Guide.

Step 2. Connect the HP 64700 Card Cage to the host computer

To communicate with the Terminal Interface, you need to connect the HP 64700 Card Cage to a terminal or a host computer that can emulate a terminal.

• Connect the emulator to a terminal, PC, or workstation by following the instructions in the HP 64700 Series Card Cage Installation/Service Guide.

Step 3. Connect the emulator to the demo board

1 Plug the PGA male connector on the emulator probe into the PGA female connector on the demo board, taking care to align pin A1 of each connector.

2 Connect power from the emulator to the demo board power socket using the cable provided.

The emulation probe must be connected to a target system (the demo board, in this procedure) to use the MC68020 or MC68030/MC68EC030 emulator. The emulator needs a powered-on system with a clock oscillator to function correctly.

The demo program examples in this manual will work correctly when you use the demo board for your target system. They may not work correctly with another target system due to the system memory map and the emulator configuration.

See Chapter 15, “Installation and Service,” for more information on the demo board and its power cable connections.

Step 4. Build a program

For this tutorial, you don’t need to build the demo program because it’s already resident in the emulator. When you’re ready to debug a target system using your own program, you can build the program in a format usable by the emulator by following these steps:

1 Create source files in “C” or MC68020/MC68030/EC030 assembly language using a text editor.

2 Translate the “C” source files to relocatable object code using a compatible C cross compiler.

Translate the assembly source files to relocatable object files using a compatible MC68020/MC68030/EC030 cross assembler.

Step 3. Connect the emulator to the demo board

3 Link all relocatable object files with the linker/loader to produce an absolute object file in HP64000 (HP-OMF) format or Motorola S-record file format.

See Chapter 4, “Using the Emulator,” for more information.

Example To build the demo program with the HP 64870 Assembler/Linker:

as68k -h demo

as68k -h handle_msg

ld68k -h -c demo.k -o demo.x

To build the demo program with the Microtec Research assembler/linker on a PC:

asm68k -fd -fh -fcase -ft -L demo.s asm68k -fd -fh -fcase -ft -L handler.s

lnk68k -c demo.k -fi -fh -fd -fs -L -o demo.x

Step 5. Apply power

Caution Possible damage to the emulator! When you use the emulator with your own target system, always turn on power to the emulator before turning on power to your system. Otherwise, the emulator or your system might be damaged.

You must apply power to the HP 64700 Card Cage before you can use the emulator and the Terminal Interface.

• Apply power to the emulator by pressing the power ON button located on the front panel of the HP 64700 Card Cage.

Example When you apply power to the emulator, you will see the following appear on your terminal screen:

Copyright (c) Hewlett-Packard Co. 1987 All Rights Reserved. Reproduction, adaptation, or translation without prior

written permission is prohibited, except as allowed under copyright laws.

HP64700B Series Emulation System Version: B.01.00 20Dec93 Location: Flash

System RAM:1 Mbyte

HP64748 Motorola 68020 Emulator HP64740 Emulation Analyzer

The emulator executes the powerup initialization procedure, then presents the Terminal Interface command prompt.

Step 6. Enter commands

To use the emulator, you enter various commands at the Terminal Interface prompt.

These commands instruct the emulator to execute some action or to report information.

• Enter a command by typing it at the Terminal Interface prompt and pressing

<RETURN> or <Enter>. (Use the key on your system that sends a carriage return).

Example Display the emulator status:

R>es Step 6. Enter commands

Step 7. Get command help

If you need to know more about a Terminal Interface command, you can use the built-in help facilities.

To display the main help menu, type: help

The main help menu lists general syntax information for the Terminal Interface. It also lists the various command groups that have more help information available.

To display help information for a particular command group, type: help

<group_name>

When you request help on a command group, the Terminal Interface displays a list of all commands in that group and a brief definition of each command.

To display help information for a particular command, type: help

<command_name>

Help information for a specific command includes a list of command options with brief explanations. Some help modules also contain a series of short command examples.

You can enter the ? symbol for the word “help.”

Examples Display main help information:

R>help

Display help information specific to the MC68020/68030/EC030 emulator:

R>help proc

Step 8. Configure the emulator

Before you use the emulator to debug your target system hardware and software, you must configure the emulator for the way you use the MC68020 or

MC68030/EC030 processor. This includes information on memory map and processor configuration. There are two primary commands that affect the emulator interface to your system.

Use the map command to define memory resource usage.

The emulator contains a memory mapper that is programmed to allocate emulation memory and control access to both emulation and target system memory. You use the map command to define the memory ranges that you want to use.

Use the cf command and its options to set other emulator configuration items, including processor configuration and the target system interface configuration.

The demo command automatically sets the proper emulator configuration for the demo program. Therefore, if you’re using the demo program to learn about the emulator, you won’t need to make any changes to the configuration. For any other system or program, you may need to make changes to the configuration. When you are ready to use the emulator to debug your system, see Chapter 7, “Configuring the Emulator.”

Step 9. Load a program

If you’re using emulation memory or your target system RAM to hold your user code, you can download programs from a host computer. This simplifies development; you can change your program on the host and load it into the emulator for immediate testing and verification.

Use the load command to download absolute files (containing programs and/or data) from a host computer into the emulator and target system memory.

Step 8. Configure the emulator

The demo command automatically loads the demo program into emulation memory from the emulator. Therefore, if you’re using the demo program to learn about the emulator, you won’t need to use the load command.

Type demo to configure the emulator and load the demo program.

To load and run the complete demo program, your emulation system must have at least 256K of emulation memory (obtained by installing at least one SRAM on the emulation probe. Refer to the Installation and Service Chapter at the end of this manual for instructions on how to install SRAM memory modules.

See Chapter 4, “Using the Emulator,” for more information on loading programs.

See Chapter 10, “Emulator Commands,” for more information on the demo command and the demo program.

Step 10. Run the program

Once you have built and loaded a program and configured the emulator, you are ready to run the program to test its functionality.

To run a program from reset, type: r rst

To run a program from the current program counter (PC) value, type: r

To run a program from a specific address, type: r <address>

<address> is a 32-bit expression. See <ADDRESS> in the “Expressions” chapter for information.

Examples Run the demo program from reset:

R>r rst

The prompt changes to U> to show processor running in user mode.

Step 11. Modify memory

The demo program has a global variable called Cmd_Input that is used as the command input buffer. You can use the emulator features to modify this memory location, which effectively enters a command for the program to interpret.

Enter the command “A” into the demo program by typing m -db demo:Cmd_Input=41.

The emulator can handle symbolic address arguments, such as demo:Cmd_Input.

These symbols must be defined to the emulator by using the sym command or by downloading a symbol table. The demo command automatically defines the correct symbols for the demo program. See the “Symbols” section in Chapter 4 of this manual for details.

The -db argument to the m (memory) command says that the modification value (41 hex) is to be interpreted as a byte value. (For example, if you used the argument -dw instead, the value would be interpreted as 0041 hex.)

Step 11. Modify memory

Step 12. Display memory

In Step 11, you modified the command input buffer variable to an ASCII “A.” You can view the output buffer of the program by displaying memory to verify that the command was correctly interpreted by the program.

1 Display the demo program’s message output buffer in byte format by typing: m -db handle_msg:Msg_Dest..Msg_Dest+1f

You will see:

000000533 43 6f 6d 6d 61 6e 64 20 41 20 65 6e 74 65 72 65 000000543 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

When you load a new section of program code, or modify code using the m command, you may want to verify that the code is what you expected. The emulator allows display of memory locations in mnemonic format.

2 Display the message handling routine for the demo program in mnemonic format by typing: m -dm Int_Cmd..47e 00000043e andle_msg:Cmd_A LEA handle_msg:Msg_A,A0 000000444 - MOVEQ #$00000010,D1

000000446 - BSR.W handle_msg:Print_Msg 00000044a - RTS

00000044c andle_msg:Cmd_B LEA handle_msg:Msg_B,A0 000000452 - MOVEQ #$00000010,D1

000000454 - BSR.W handle_msg:Print_Msg 000000458 - RTS

00000045a andle_msg:Cmd_I LEA handle_msg:Msg_I,A0 000000460 - MOVEQ #$0000000E,D1

000000462 - BSR.W handle_msg:Print_Msg 000000466 - RTS

000000468 e_msg:Print_Msg LEA handle_msg:End_Msgs,A1 00000046e andle_msg:Again MOVE.B (A0)+,(A1)+

000000470 - DBEQ D1,handle_msg:Again 000000474 e_msg:Fill_Dest MOVE.B #$00,(A1)+

000000478 - CMPA.W #$0553,A1

00000047c - BNE.B handle_msg:Fill_Dest 00000047e - RTS

Notice that you can mix symbols and numeric values in ranges.

When you use the -dm option, the emulator disassembles the memory locations beginning with the first address you specify. If this address is not the starting address of an instruction, the display will be incorrect.

Step 13. Start and display a trace

The emulation-bus analyzer is a powerful tool that allows you to view the execution of your program in real-time. You can have the analyzer trigger on a specific state so that it captures only the information you need. That way, you won’t spend time searching through trace lists of unimportant information.

1 Define a simple trigger on the address value of the symbol Print_Msg by typing: tg addr=handle_msg:Print_Msg

Often, you’ll want the analyzer to recognize its trigger when a certain program location is reached. You can use either a simple address expression, or one that includes symbols.

The analyzer doesn’t begin examining data until you start a trace.

2 Begin an emulation-bus analyzer trace by typing: t

When you start a trace, the analyzer begins searching for the trigger specification while saving data according to your storage specifications. Once the trigger has been found, you can display any states that are stored.

The program code at Print_Msg is executed only when the program interprets a command. To set up this condition, you’ll need to enter a command. (The processor must be running, enter r if it isn’t.)

3 Enter the command “B” for the sample program by typing: m -db demo:Cmd_Input=42.

Once you enter the command, the analyzer will find the trigger condition and fill the trace buffer with program states.

Step 13. Start and display a trace

After the analyzer completes the trace measurement, you can display the trace to view the execution of the program.

4 Display the disassembled and dequeued trace list with symbols and addresses by typing: tl -e -d -od 0

The trace list is a 512 or 1024 state deep buffer (depending on whether you time stamp the states with tcq). You can selectively display portions of the buffer using the tl command. See Chapter 5, “Using the Analyzer.”

Step 14. Break to monitor

The emulation monitor is a program that provides various emulation functions, including register access and target system memory manipulation. The emulator must break program execution into the monitor before executing certain emulation commands, such as those accessing registers, or target system memory. You also can use the break command to pause target program execution.

Break the emulation processor into the monitor by typing: b

The prompt changes to M> to show that the processor is running in the monitor.

You can use either a foreground or background monitor. See Chapter 7,

“Configuring the Emulator,” for more information.

Step 15. Reset the emulator

When you apply power to the emulator, the initialization process leaves the emulator in the reset state. Changing some configuration items also resets the processor. (See Chapter 7, “Configuring the Emulator,” for more information.) Sometimes you may want to reset the emulation processor. This may be done from the emulator or the target system.

To reset the emulation processor from the emulator, type: rst The prompt will change to R>.

Step 15. Reset the emulator

Troubleshooting

Finding out what’s wrong and fixing it

This chapter explains how to diagnose and solve simple problems you might encounter when you first get started using the emulator. It doesn’t explain how to solve more complex problems or how to interpret error messages. See Part 2 of this manual for more comprehensive problem solutions.

Documents relatifs