What is 'N/A (alignment)' in the IAR XLINK Linker map file?
Technical Note 35041
Architectures:
8051, AVR, AVR32, Coldfire, CR16C, H8, HCS12, M16C, M32C, MAXQ, MSP430, R32C, R8C, S08, SAM8, V850, 78K
Component:
linker
Updated:
10/12/2021 2:23 PM
Introduction
Read this technical note to understand why the IAR XLINK Linker™ generates the 'N/A (alignment)' entry in the map file.
Discussion
The 'N/A (alignment)' entry shows bytes lost due to alignment restrictions on segments.
Example
Placement command example for the IAR XLINK Linker:
-Z(DATA)A,B,C=0-FFFF
Assumption
- Segment A has a size of
0x1F
bytes and an alignment of 0 (1-byte aligned) - Segment B has a size of
0xA
bytes and an alignment of 1 (2-byte aligned) - Segment C has a size of
0x40
bytes and an alignment of 2 (4-byte aligned)
Result
- Segment A is placed on
0x00-0x1E
- Segment B is placed on
0x20-0x29
(1 byte, 0x1F, is lost due to alignment) - Segment C is placed on
0x2C-0x6B
(2 bytes, 0x2A and 0x2B, are lost due to alignment)
The module summary list 3 bytes as N/A (alignment) in this case.
Suggestion
Reverse the order of 'A,B,C'
in the placement command to 'C,B,A'.
The reason is that allocating segments in falling alignment order doesn’t generate byte 'spill'.
With falling alignment order the result is:
- Segment C is placed on
0x00-0x3F
- Segment B is placed on
0x40-0x49
- Segment A is placed on
0x4A-0x68
Conclusion
The N/A (alignment) entry allows you to quickly see if any bytes are lost due to alignment restrictions.
All product names are trademarks or registered trademarks of their respective owners.