Onboard debugger
The onboard debugger provides a very low level method of debugging
software. Usually supplied as a set of EPROMs which are plugged into the board
or as a set of software routines that are combined with the applications code,
they use a serial connection to communicate with a PC or workstation. They
provide several functions: the first is to provide initialisa-tion code for the
processor and/or the board which will nor-mally initialise the hardware and
allow it to come up into a known state. The second is to supply basic debugging
facilities and, in some cases, allow simple access to the board’s periph-erals.
Often included in these facilities is the ability to download code using a serial
port or from a floppy disk.
>TR
PC=000404 SR=2000 SS=00A00000 US=00000000 X=0
A0=00000000 A1=000004AA A2=00000000 A3=00000000 N=0
A4=00000000 A5=00000000 A6=00000000 A7=00A00000 Z=0
D0=00000001 D1=00000013 D2=00000000 D3=00000000 V=0
D4=00000000 D5=00000000 D6=00000000 D7=00000000 C=0
---------->LEA $000004AA,A1
>TR
PC=00040A SR=2000 SS=00A00000 US=00000000 X=0
A0=00000000 A1=000004AA A2=00000000 A3=00000000 N=0
A4=00000000 A5=00000000 A6=00000000 A7=00A00000 Z=0
D0=00000001 D1=00000013 D2=00000000 D3=00000000 V=0
D4=00000000 D5=00000000 D6=00000000 D7=00000000 C=0
---------->MOVEQ #19,D1
>
Example display from an onboard M68000 debugger
When the board is powered up, the processor fetches its reset vector
from the table stored in EPROM and then starts to initialise the board. The
vector table is normally transferred from EPROM into a RAM area to allow it to
be modified, if needed. This can be done through hardware, where the EPROM
memory address is temporarily altered to be at the correct location for
power-on, but is moved elsewhere after the vector table has been copied.
Typically, a counter is used to determine a preset number of memory accesses,
after which it is assumed that the table has been transferred by the debugger
and the EPROM address can safely be changed.
The second method, which relies on processor support, allows the vector
table to be moved elsewhere in the memory map. With the later M68000
processors, this can also be done by changing the vector base register which is
part of the supervi-sor programming model.
The debugger usually operates at a very low level and allows basic
memory and processor register display and change, setting RAM-based breakpoints
and so on. This is normally performed using hexadecimal notation, although some
debuggers can provide a simple disassembler function. To get the best out of
these systems, it is important that a symbol table is generated when compiling
or linking software, which will provide a cross-reference between labels and
symbol names and their physical address in memory. In addition, an assem-bler
source listing which shows the assembler code generated for each line of C or
other high level language code is invalu-able. Without this information it can
be very difficult to use the debugger easily. Having said that, it is quite
frustrating having to look up references in very large tables and this
highlights one of the restrictions with this type of debugger.
While considered very low level and somewhat limited in their use,
onboard debuggers are extremely useful in giving confidence that the board is
working correctly and working on an embedded system where an emulator may be
impractical. However, this ability to access only at a low level can also place
severe limitations on what can be debugged.
The first problem concerns the initialisation routines and in particular
the processor’s vector table. Breakpoints use either a special breakpoint
instruction or an illegal instruction to generate a processor exception when
the instruction is executed. Program control is then transferred to the
debugger which displays the breakpoint and associated information. Similarly,
the debugger may use other vectors to drive the serial port that is connected
to the terminal.
This vector table may be overwritten by the initialisation routines of
the operating system which can replace them with its own set of vectors. The
breakpoint can still be set but when it is reached, the operating system will
see it instead of the debugger and not pass control back to it. The system will
normally crash because it is not expecting to see a breakpoint or an illegal
instruction!
To get around this problem, the operating system may need to be either
patched so that its initialisation routine writes the debugger vector into the
appropriate location or this must be done using the debugger itself. The
operating system is single stepped through its initialisation routine and the
in-struction that overwrites the vector simply skipped over, thus preserving
the debugger’s vector. Some operating systems can be configured to preserve the
debugger’s exception vectors, which removes the need to use the debugger to
preserve them.
A second issue is that of memory management where there can be a problem
with the address translation. Break-points will still work but the addresses
returned by the debugger will be physical, while those generated by the symbol
table will normally be logical. As a result, it can be very difficult to
reconcile the physical address information with the logical information.
The onboard debugger provides a simple but some-times essential way of
debugging VMEbus software. For small amounts of code, it is quite capable of
providing a method of debugging which is effective, albeit not as efficient as
a full blown symbolic level debugger — or as complex or expensive. It is often
the only way of finding out about a system which has hung or crashed.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.