Intel Processor Computer Hardware User Manual


 
Developers Manual March, 2003 13-51
Intel
®
80200 Processor based on Intel
®
XScale
Microarchitecture
Software Debug
2. Using the Main IC
The steps for downloading dynamic functions into the main instruction cache is similar to
downloading into the mini instruction cache. However, using the main instruction cache has its
advantages.
Using the main instruction cache eliminates the problem of inadvertently overwriting static
Debug Handler code by writing to the wrong way of a set, since the main and mini instruction
caches are separate. The debug handler code does not need to be specially mapped out to avoid
this problem. Also, space for dynamic functions does not need to be allocated in the mini
instruction cache and dynamic functions are not limited to the size allocated.
The dynamic function can actually be downloaded anywhere in the address space. The
debugger specifies the location of the dynamic function by writing the address to RX when it
signals to the handler to continue. The debug handler then does a branch-and-link to that
address.
If the dynamic function is already downloaded in the main instruction cache, the debugger
immediately downloads the address, signalling the handler to continue.
The static Debug Handler only needs to support one dynamic function command. Multiple
dynamic functions can be downloaded to different addresses and the debugger uses the
function’s address to specify which dynamic function to execute.
Since the dynamic function is being downloaded into the main instruction cache, the
downloaded code may overwrite valid application code, and conversely, application code may
overwrite the dynamic function. The dynamic function is only guaranteed to be in the cache
from the time it is downloaded to the time the debug handler returns to the application (or the
debugger overwrites it).
External memory
Dynamic functions can also we downloaded to external memory (or they may already exist
there). The debugger can download to external memory using the write-memory commands.
Then the debugger executes the dynamic command using the address of the function to
identify which function to execute. This method has the many of the same advantages as
downloading into the main instruction cache.
Depending on the memory system, this method could be much slower than downloading
directly into the instruction cache. Another problem is the application may write to the
memory where the function is downloaded. If it can be guaranteed that the application does
not modify the downloaded dynamic function, the debug handler can save the time it takes to
re-download the code. Otherwise, the ensure the application does not corrupt the dynamic
functions, the debugger should re-download any dynamic functions it uses.
For all three methods, the downloaded code executes in the context of the debug handler. The
processor is in Special Debug State, so all of the special functionality applies.
The downloaded functions may also require some common routines from the static debug handler,
such as the polling routines for reading RX or writing TX. To simplify the dynamic functions, the
debug handler should define a set of registers to contain the addresses of the most commonly used
routines. The dynamic functions can then access these routines using indirect branches (BLX).
This helps reduce the amount of code in the dynamic function since common routines do not need
to be replicated within each dynamic function.