Search code examples
clinkermemory-alignmentmap-files

How to interpret alignment in map file? (Tasking compiler)


Could you explain how alignment in map file works?

enter image description here

I thought that alignment works like that: I have a variable/section that is one byte in size, but due to 4 bytes of alignment it occupies 4 bytes. But according to the map file from the screenshot, "OS_DATA_CORE0_VAR_INIT_PAD" section starts in the address that should be assigned to "OS_DATA_CORE0_VAR_INIT_SEC" section due to the 16 bytes of alignment.


Solution

  • I thought that alignment works like that: I have a variable/section that is one byte in size, but due to 4 bytes of alignment it occupies 4 bytes.

    It's rather that if you have a section with alignment e. g. 4, this starts at an address which is a multiple of 4, so this alignment introduces a gap between the preceding section and this section unless the preceding section ends at an address divisible by 4.