Keil™, An ARM® Company

µVision® User's Guide

MAP

SyntaxDescription
MAPDisplays the current memory map.
MAP start, end READ WRITE EXEC VNMMaps the specified memory range (start-end) accesses as specified.
MAP start, end CLEARClears a mapped memory range.

Target programs you debug with µVision3 access and use memory. µVision3 uses the symbol information in your target program to automatically setup the memory map for most applications. The MAP command lets you specify the memory areas your program uses that are not automatically detected by µVision3.

When you run your target program, µVision3 checks each memory access to determine if it is outside the memory map. If an invalid access is made, µVision3 reports an access violation error. This helps you locate and correct memory problems in your program.

Note

  • If your program uses memory-mapped I/O devices or dynamically accesses memory through pointers, you may need to make changes to the memory map.

You specify an address range with the MAP command along with the accesses allowed for that range. Read (READ), write (WRITE), and execution (EXEC) accesses (or any combination) may be specified. The memory map supports 1-byte granularity.

The VNM option identifies the specified memory range as von Neumann memory. When VMN is specified with an address range, µVision3 overlaps external data memory (XDATA) and code memory. Write accesses to external data memory also change code memory. Memory ranges specified with VNM may not be a range from the code area and may not cross a 64K boundary. The address range specified must be from the external data area.

The MAP command, when entered with no other parameters, displays the current memory map for your target program. This lets you check your memory map settings.

The CLEAR option lets you remove an address range previously specified with the MAP command.

When µVision3 loads, the following memory maps are defined.

CPUAddress RangeAccess
8051 Family0x000000-0x00FFFF (DATA)READ WRITE
 0x010000-0x01FFFF (XDATA)READ WRITE
 0xFF0000-0xFFFFFF (CODE)EXEC READ
251 Family0x000000-0x00FFFF (DATA)READ WRITE
 0x010000-0x01FFFF (XDATA)READ WRITE
 0xFF0000-0xFFFFFF (CODE)EXEC READ
166 Family0x000000-0x00FFFFEXEC READ WRITE

µVision3 supports up to 16MB of memory. This memory is divided into 256 segments of 64K each. The default 8051 and 251 memory spaces are assigned by µVision3 to the segments with the numbers listed in the following table.

Segment ValueMemory Space
0x00MCS® 51 DATA segment, 0x00:0x0000—0x00:0x00FF.
MCS® 251 EDATA segment, 0x00:0x0000-0x00:0xFFFF.
0x01MCS® 51 and MCS® 251 XDATA segment 0x01:0x0000-0x01:0xFFFF.
0x80-0x9FMCS® 51 and MCS® 251 Code Bank 0 through Code Bank 31.
0x80 Code Bank 0, 0x81 Code Bank 1, etc.
0xFEMCS® 51 and MCS® 251 PDATA segment 0xFE:0x0000-0xFE:0x00FF.
0xFFMCS® 51 and MCS® 251 CODE segment 0xFF:0x0000-0xFF:0xFFFF.

Although µVision3 supports up to 16MB of target program memory, only the memory ranges required should be mapped. µVision3 requires two copies of each block allocated in the memory map. One copy holds the data used for reading, writing, and execution. Another copy holds the specific attributes such as access permissions and information for code coverage and performance analysis. For this reason, mapping huge amounts of memory may slow down the execution speed of µVision3 since disk swapping may be required.

The RESET MAP command clears all mapped segments and restores the default mapping shown above. Refer to RESET for more information.

You may also use the Memory Map dialog to review and change the memory mapping. This dialog opens via the main menu Debug – Memory Map....

Note

  • Mapping less than 256 bytes of XDATA for 8051-compatible devices may cause problems. The 8051 supports a fast method of accessing 256 bytes of XDATA using the MOVX @Ri instructions. When more than 256 XDATA bytes are mapped, µVision3 uses the contents of P2 and P0 to resolve the full 16-bit address. When fewer than 256 XDATA bytes are mapped, µVision3 uses only the contents of P0 and P2 is ignored. Therefore, XDATA memory must start at the beginning of a segment (by default is 0x01:0x0000 to 0x01:0x00FF).