Keil Logo

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 the 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
DATA D:0x00-D:0x7F Registers, bits, variables, stack, and so on.
CODE C:0x0000-C:0x1FFF In-system target monitor location.
CODE C:0x2000-C:0x7FFF Unavailable.
CODE C:0x8000-C:0xFEFF von Neumann-mapped program memory.
CODE C:0xFF00-C:0xFFFF von Neumann-mapped data area reserved for the monitor.
XDATA X:0x0000-X:0x7FFF XDATA memory available to program.
XDATA X:0x8000-X:0xFFFF von 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:

LX51 MYCODE.OBJ &
     SEGMENTS ( &
              DATA(D:0x00-D:0x7F), IDATA(I:0x00-I:0x7F), &
              CODE(C:0x8000-C:0xFEF), &
              XDATA(X:0x0000-X:0x7FFF)
              )
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.