logical directive
Syntax
logicalrange-list= physicalrange-list
where range-list is one of
[region-expr,... ]region-expr
[region-expr,... ]fromaddress-expr
Parameters
| A region expression, see also Regions. |
| An address expression |
Description
The logical directive maps logical addresses to physical addresses. The physical address is typically used when loading or burning content into memory, while the logical address is the one seen by your application. The physical address is the same as the logical address, if no logical directives are used, or if the address is in a range specified in a logical directive.
When generating ELF output, the mapping affects the physical address in program headers. When generating output in the Intel hex or Motorola S-records formats, the physical address is used.
Each address in the logical range list, in the order specified, is mapped to the corresponding address in the physical range list, in the order specified.
Unless one or both of the range lists end with the from form, the total size of the logical ranges and the physical ranges must be the same. If one side ends with the from form and not the other, the side that ends with the from form will include a final range of a size that makes the total sizes match, if possible. If both sides end with a from form, the ranges will extend to the highest possible address that makes the total sizes match.
Setting up a mapping from logical to physical addresses can affect how sections and other content are placed. No content will be placed to overlap more than one individual logical or physical range. Also, if there is a mapping from a different logical range to the corresponding physical range, any logical range for which no mapping to physical ranges has been specified—by not being mentioned in a logical directive—is excluded from placement.
All logical directives are applied together. Using one or using several directives to specify the same mapping makes no difference to the result.
Examples
// Logical range 0x8000-0x8FFF maps to physical 0x10000-0x10FFF. // No content can be placed in the logical range 0x10000-0x10FFF. logical [from 0x8000 size 4K] = physical [from 0x10000 size 4K];
// Another way to specify the same mapping logical [from 0x8000 size 4K] = physical from 0x10000;
// Logical range 0x8000-0x8FFF maps to physical 0x10000-0x10FFF. // Logical range 0x10000-0x10FFF maps to physical 0x8000-0x8FFF. // No logical range is excluded from placement because of // this mapping. logical [from 0x8000 size 4K] = physical [from 0x10000 size 4K]; logical [from 0x10000 size 4K] = physical [from 0x8000 size 4K];
// Logical range 0x1000-0x13FF maps to physical 0x8000-0x83FF. // Logical range 0x1400-0x17FF maps to physical 0x9000-0x93FF. // Logical range 0x1800-0x1BFF maps to physical 0xA000-0xA3FF. // Logical range 0x1C00-0x1FFF maps to physical 0xB000-0xB3FF. // No content can be placed in the logical ranges 0x8000-0x83FF, // 0x9000-0x9FFF, 0xA000-0xAFFF, or 0xB000-0xBFFF. logical [from 0x1000 size 4K] = physical [from 0x8000 size 1K repeat 4 displacement 4K];
// Another way to specify the same mapping. logical [from 0x1000 to 0x13FF] = physical [from 0x8000 to 0x83FF]; logical [from 0x1400 to 0x17FF] = physical [from 0x9000 to 0x93FF]; logical [from 0x1800 to 0x1BFF] = physical [from 0xA000 to 0xA3FF]; logical [from 0x1C00 to 0x1FFF] = physical [from 0xB000 to 0xB3FF];