Tirdad Sadri Nejad
Tirdad Sadri Nejad

Reputation: 167

What are these sections in a Linker's map file?

My COSMIC-C linker generates a map file for my STM8S microcontroller project, which despite having a few familiar sections, is a little inexpressive.

here is the map file output and a few modules :

                                --------
                               Segments
                               --------

start 00008080 end 00008084 length     4 segment .const
start 00008087 end 00008298 length   529 segment .text
start 00004000 end 00004000 length     0 segment .eeprom
start 00000000 end 00000000 length     0 segment .bsct
start 00000000 end 0000000a length    10 segment .ubsct
start 0000000a end 0000000a length     0 segment .bit
start 0000000a end 0000000a length     0 segment .share
start 00000100 end 00000100 length     0 segment .data
start 00000100 end 00000100 length     0 segment .bss
start 00000000 end 000003be length   958 segment .info.
start 00008000 end 00008080 length   128 segment .const
start 00008084 end 00008087 length     3 segment .init


                               -------
                               Modules
                               -------

D:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\crtsi0.sm8:
start 00008087 end 000080d7 length    80 section .text
start 00000100 end 00000100 length     0 section .bss
start 00000000 end 00000000 length     0 section .ubsct
start 00000000 end 00000034 length    52 section .info.

Release\clockcontrol.o:
start 000080d7 end 000080f7 length    32 section .text
start 00000034 end 000000c1 length   141 section .info.

Release\main.o:
start 000080f7 end 00008145 length    78 section .text
start 000000c1 end 00000146 length   133 section .info.
start 00008080 end 00008084 length     4 section .const

I know about the .text and .data. and I can assume the bsct and ubsct are data and bss (despite having a .data and .bss already); also about .eeprom and .const which may represent their obvious memory sections. but :

  1. what are .info, .bit, .share, .init ?
  2. is my assumption about .bsct and .ubsct correct ? if no, what are these sections and if yes, why we have both .bsct/.ubsct and .data/.bss ?
  3. why do we have two .const? (they are consecutive)
  4. despite being defined, none of the items mentioned in question 1 appear in any modules which are my codes. are they just standards ?
  5. do these sections follow a naming convention or they're just something out of COSMIC ? I mean if they are standard or not.

with many thanx.

Update:

the COSMIC linker documentation has many descriptions on how to make a linker script, but doesn't have a predefined table. it seems the script is edited by STVD (the IDE). despite that, there is an example (not very related to my question) which may help:

enter image description here

Upvotes: 1

Views: 1701

Answers (0)

Related Questions