BL51 User's Guide

Using a Target Monitor

Programs you test using MON51 or MON390 may require relocation to a new starting address. Typically, this requires that you:

  1. Change the reset vector in the startup code.
  2. Relocate all interrupt vectors to a new location.
  3. Relocate all program code to a new location.

In many cases, the monitor program resides at the beginning of memory (from 0x0000 to about 0x1000 in code space). Additionally, some XDATA memory is cleverly mapped as CODE memory (creating a pseudo-von Neumann architecture).

There are two tasks for linker when linking such programs:

  1. Set the available CODE memory for the program under test.
  2. Avoid the XDATA memory mapped into CODE space.

The following table lists the memory map for the target system.

Memory
Area
Address
Range
Usage
DATAD:0x00-D:0x7FRegisters, bits, variables, stack, and so on.
CODEC:0x0000-C:0x1FFFIn-system target monitor location.
CODEC:0x2000-C:0x7FFFUnavailable.
CODEC:0x8000-C:0xFEFFvon Neumann-mapped program memory.
CODEC:0xFF00-C:0xFFFFvon Neumann-mapped data area reserved for the monitor.
XDATAX:0x0000-X:0x7FFFXDATA memory available to program.
XDATAX:0x8000-X:0xFFFFvon Neumann-mapped program memory. Do not use this as XDATA memory!

The CODE memory available to the test program is 0x8000-0xFEFF. The XDATA memory available to the test program is 0x0000-0x7FFF. So, the linker command line should appear as:

BL51 MYCODE.OBJ &
     RAMSIZE(128) &
     CODE(0x8000-0xFEF) &
     XDATA(0x0000-0x7FFF)