• Aucun résultat trouvé

Set up the emulator for the foreground monitor

Dans le document Real-Time C Debugger for68302 (Page 108-112)

Configuring the Emulator for In-Circuit Operation

Step 6. Set up the emulator for the foreground monitor

Skip this step if you have decided not to use the foreground monitor.

Here are the steps you should follow if you choose to use the foreground monitor:

1 Choose an address for the monitor. Unlike the background monitor, the foreground monitor resides in the same memory space as your program (hence the term "foreground"). You must first select the address where the monitor will reside. Here are some considerations:

- The monitor MUST reside in emulation memory. Note that when you configure the emulator and answer the questions regarding the foreground monitor the memory map will automatically be modified to include a block of emulation RAM for the monitor.

- All monitor cycles ( both reads and writes ) WILL be seen by your target system, therefore, you must choose an address that your target system will

"tolerate". For example, if your target has a range of memory that is decoded for read-only accesses you should not locate the monitor there.

- You should not locate the monitor in area that your program may overwrite.

The monitor must be mapped to emulation RAM, so you must be careful to not allow it to get overwritten.

Chapter 4: Plugging the Emulator into Target Systems Configuring the Emulator for In-Circuit Operation

108

Note If you are using 1 Mbyte SIMMs in your 68302 emulator, you MUST locate the monitor on an 8 Kbyte boundary; otherwise, locate the the monitor on a 2 Kbyte boundary.

Note A defect in firmware revision A.00.03 of the 68302 emulator will prevent the monitor from successfully loading at any address whose first non-zero digit is not numeric. For example, you would not be able to locate the monitor at 0A0000H, 0B0000H, 0A000H, etc. You could load it at address 1A0000H, 3B0000H, etc. To check the revision of your 68302 firmware issue the command "ver" from the terminal interface This problem does not exist in firmware revision A.00.04.

2 Make a local copy of the monitor source file,

C:\HP\RTC\M302\FGMON\FGMON.S (if C:\HP\RTC\M302 was the installation path chosen when installing the debugger software).

3 Modify the monitor source file. You need to uncomment the "ORG"

directive and put the address chosen in step number 1 in the address field.

4 Assemble and link the monitor.

For the HP AxLS assembler, use the command:

as68k -L fgmon.s > fgmon.lst

For the Microtec 68000 assembler, use the command:

asm68k -l fgmon.s > fgmon.lst

5 Link the monitor.

For the HP AxLS linker, use the command:

ld68k -o fgmon fgmon.o

For the Microtec linker, use the command:

Chapter 4: Plugging the Emulator into Target Systems Configuring the Emulator for In-Circuit Operation

6 Modify your emulator configuration to specify a foreground monitor, specify the address you chose and the filename you created (in this example, the filename is FGMON.X for the Microtec or HP AxLS linker).

7 Make sure that the address range 0FFF000H through 0FFFFFFH is mapped as "target RAM". This is important because the emulator will attempt to access the on-chip locations of the 68302 upon entering the monitor. It uses the default address for the BAR, placing the internal register section at address 0FFF000H. Leaving this as guarded will cause a guarded access error, mapping it to emulation RAM will cause unpredictable results.

If You Plan to Single-Step

If you plan to single-step when using the foreground monitor there’s one more thing you need to do. You need to ensure that the vector table entry at location 24H points to the label "TRACE_ENTRY" in the foreground monitor module. You can determine what this address is by looking at the listing file created when you assembled the monitor. There are many approaches you can take to ensure this, including:

• Modify your own code to place the value of TRACE_ENTRY at location 24H. This is probably the most robust method because you can account for things such as a RAM-based vector table that is loaded by your initialization code.

• Use a modify memory command to put the value of TRACE_ENTRY at 24H after loading your program. This works fine if your program doesn’t overwrite or re-initialize the vector table during execution.

• Use a command file to single step that first modifies memory location 24H to point to TRACE_ENTRY, then steps. For example:

MEMORY FILL LONG 24..27 XXXXXXH STEP

where XXXXXXH is the address of TRACE_ENTRY

You shouldn’t need to use this method unless your program or operating system is continuously changing the vector table contents.

Chapter 4: Plugging the Emulator into Target Systems Configuring the Emulator for In-Circuit Operation

110

If you are mapping the vector table to a target ROM area and are not able to modify location 24H, you can map the vector table area to emulation RAM, copy the contents of your target ROM to emulation RAM, then modify location 24H. Here are the steps needed to do this:

1 Map 0 through 3FFH as emulation RAM.

2 From the Memory window’s control menu, choose the Utilities→Image...

(ALT, -, U, I) command. Enter a start address of 0, an end address of 03ffh, and choose the OK button.

3 Modify the long word of memory at address 24H to the address of TRACE_ENTRY.

Note The Utilities→Image... (ALT, -, U, I) command allows you map a section of memory as emulation RAM or ROM and copy the contents of your target memory to that section. In this example, it is used to read all locations 0 through 3FFH from your target ROM, then write those values to emulation memory. This is a convenient way of making changes to your target ROM without having to burn new ROMs.

If You Need Interrupts Serviced While Running in the Monitor By default, the foreground monitor leaves the Interrupt Mask of the 68302 at 7 after a "break" into the monitor. If you wish to have any interrupts other than level 7 interrupts serviced while the monitor is running, you must modify the monitor source code. The monitor source has the following instructions commented out:

Simply uncomment the instructions shown above and reassemble and relink the monitor; then, reload your configuration.

Note that the monitor is not reentrant. This means that you should be careful not to cause a "break" into the monitor at a time when your program may have interrupted the monitor. An example of this would be a case where you set a breakpoint inside one of your interrupt service routines, and that

Chapter 4: Plugging the Emulator into Target Systems Configuring the Emulator for In-Circuit Operation

Dans le document Real-Time C Debugger for68302 (Page 108-112)

Documents relatifs