Memory map files are tree structured descriptions of the target memory map. Memory map files are used by the compiler to ensure correct placement of program sections. Memory map files are used by the debugger so that it knows which memory addresses are valid on the target and which program sections to load. You can also use the memory files to direct the debugger to display memory mapped peripherals. Usually you don’t need to modify memory map files—they will be set up for the particular targets that CrossStudio supports but it is useful to view them with the memory map editor.

You can open memory map files using File > Open and selecting the XML file that contains the memory map or alternatively using the View Memory Map option on the context menu of the Project Explorer.

The memory map editor provides a tree structured view of the memory space of a target. The memory map consists of a set of different node types that are arranged in a hierarchy. These nodes have properties that can be modified using the properties window when the node is selected. These properties and the placement of nodes within the memory map are used as input to the program building process so that the linker knows where sections should be placed. Additionally the debugger uses the information in memory map files to enable register display and memory display.

The memory map editor supports the following node types:

Root
  The top most node of the memory map.
Memory Segment
  A range of addresses that represents a memory region in the target.
Program Section
  Represents a program section of your application.
Register Group
  Represents an area of memory that contains a group of related registers.
Register
  Represents a memory mapped register.
Bit Field
  Part of a memory mapped register.

The following statements hold regarding the creation and movement of nodes within a memory

- Memory segments can be within the Root segment.
- Program sections must be within a memory segment.
- Register groups can be within the Root or within a memory segment.
- Registers can be within memory segments or register groups.
- Bit Fields can be within registers.

All nodes have mandatory and optional properties associated with them. All nodes have a mandatory Name property. This name should be unique within the memory map.

###### Memory segment and register group properties

Start Address
  A hexadecimal number stating where the memory begins (lowest address).
Start Address Symbol
  The name of a linker symbol to generate that has the value of the Start Address.
Size
  A hexadecimal number that defines the size in bytes of the memory segment.
Size Symbol
  The name of a linker symbol to generate that has the value of the Size.
Access Type
  Specifies if the memory segment is read only or read/write.

###### Program section properties

Start Address
  An optional hexadecimal value that is the absolute load position of the section. If this isn’t set then the relative placement of the program section within the memory segment will determine the load position of the section.
Size
  An optional decimal value that is the size in bytes of the program section.
Load
  Specifies whether or not the section should be loaded by the debugger.
Alignment
  An optional decimal value that specifies the alignment requirements of the section.
Section To Run In
  An optional name of another program section that this program section will be copied to.
Input Section Names
  The optional names of the files that will be placed into this section.

###### Register properties

Start Address
  A hexadecimal value specifying where the register is placed.
Start Address Symbol
  The name of a linker symbol to generate that has the value of the Start Address.
Register Type
  Optional, a C type specifying how you want the register to be displayed. The defaults to the word length of the target processor.
Endian
  Optional, specifies the byte order of a multibyte register. This defaults to the byte order of the target processor.

###### Bitfield properties

Bit Offset
  A decimal value that is the starting bit position of the bit field. Bit 0 is the first bit position.
Bit Length
  A decimal value that defines the number of bits in the field.

The editor has many of the attributes of the text editor and the same key-bindings for example cut, copy and paste are all accessible from the Edit menu. In addition to the standard editor capabilities the memory map editor supports the movement up and down of nodes within a hierarchy. This enables the sequencing of program sections to be achieved.