omasso1
omasso1

Reputation: 15

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.

Upvotes: 1

Views: 226

Answers (1)

Armali
Armali

Reputation: 19395

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.

Upvotes: 1

Related Questions