An address mode is applied to a memory segment as a part of the ROM image or at the executing (or logical) address of the segment. Following address modes can be applied to a memory segment:
Consider an example where the segment .foo is a part of ROM Image and will be copied to a RAM location. The link time addresses are:
Also assume that the real time (physical) ROM address is 0x00200000 instead of the link time specified address 0x00100000. Possible addr_mode Scenarios lists the possible address mode scenarios.
| Scenario | ROM addr_mode | RAM addr_mode | Description |
|---|---|---|---|
| A | internal | external | Runtime correctly figures out that the ROM address is 0x00200000 and copies it to 0x00002000 |
| B | internal | internal | Runtime correctly figures out that the ROM address is 0x00200000 and copies it to 0x00102000 |
| C | external | external | Runtime incorrectly assumes that the ROM address is 0x00100000 and copies it to 0x00002000 |
| D | external | internal | Runtime incorrectly assumes that the ROM address is 0x00100000 and copies it to 0x00102000 |
In the above possible scenarios only A and B are correct. The difference between scenario A and B is that in A, the executing (logical) address of .foo is absolute and that in B, the executing (logical) address of.foo is relative.
Scenario C and D are possible if .foo is flashed to ROM at its correct ROM address and all other segments are at an offset from their link time ROM addresses.