Here are the predefined section used by the compiler is using:
I hope this helps.
Just an addition to the above. I'm working with CW 6.4 and it ignores the LCF *(COMMON) output section and sticks all uninitialised global data in the .bss section. !!??!!
I have the following:
1. static int x; > .bss
2. static int y = 1; > .data
3. static int y = 0; > .bss Couldn't this be quite dangerous as it relies on the start-up code zeroing the .bss. Uninitialised data should always be initialised before use.
4. int a > .bss This should be emitted to .common or in this case *(COMMON) if provide the LCF however if I look at a disassembled c module the compiler does provide the required named section. This can be seen by looking at the section index field (Shndx) in the symbol table.
5. int a =1; > .data
Also the linker documentation is very poor. Try searching the help file for COMMON, SCOMMON or .common ;0)
Snippet from my LCF
__START_BSS = .;
. = ALIGN(0x8);
# This should be for common GLOBAL variables declared in compiled code outside of any function
# without the extern or static qualifier and which are not initialized. line has no effect!
# All global uininitialised data declared as static,extern or with no type class specifier
# are emmited to .bss TOGETHER WITH DATA INITIALISED TO 0
__END_BSS = .;
} >> DATA
the original post was for HC12 V4.5 architecture.
the linker parameter file is not the same for the HC12 architecture and Coldfire.
to check the issue I recommend you to create a new post for this question.
Be aware the Coldfire V6.4 is an old version.
the last version based on Classic IDE is the V7.2.
the last development for Coldfire is CW for MCU V10.4 based on Eclipse.
I could investigate the problem/question.
In this case can you please create a new post for this question.
As far as I'm aware the .common section is part of the ELF standard and is independent of processor architecture. There are many people that use and do not properly understand boiler plate LCF supplied with the tool chain and there is no description in the linker documentation regarding this. Also there are many people that use older versions of the CW IDE. I would have thought from the title and content of this post that the general nature of the issue would be relevant on this thread.
I've checked with compiler team and my understanding was correct.
Both SCOMMON and COMMON are used for sections related to .common
I think I've understand the problem/question.
I need to work on it.
according to Catherine feedback the
.common: Contains the un-initialized global variables (not static).
so in case of int a_1; the map file should use the SCOMMON or COMMON and not the .bss.
Hello CrasyCat and Pascal,
On CW10.6, S12Z chips , it seems no matter how i define the variable , it can not put in to the .bss segment .
int i = 0;
static int j ;
Why ? And how can i put the variable to .bss segment ?
Retrieving data ...