AnsweredAssumed Answered

Stored location of uninitialised varaibles

Question asked by Amit Dhand on Jul 21, 2015
Latest reply on Jul 23, 2015 by Alice_Yang

Hello,

 

I am working on s12zvc demo board. I have few variables mentioned below :-

 

int b_main;

int c_main = 10;

static int d_main;

static int e_main = 23;

 

According to the definition of .bss and .data segment uninitialised varaibles should go into .bss segment and explicitly initialised variable to the .data segment.

But what I have observed is shown below :-

 

*********************************************************************************************

OBJECT-ALLOCATION SECTION

     Name               Module                 Addr   hSize   dSize     Ref    Section   RLIB

---------------------------------------------------------------------------------------------

 

- VARIABLES:

     c_main                                    1000       2       2       1   .data      

     e_main                                    1002       2       2       1   .data      

     d_main                                    1008       2       2       1   .common    

     b_main                                    100A       2       2       3   .common  

 

 

How could I change the segment from .common to .bss and I need only few variables to be there in the .bss segment.

 

Thank you.

Outcomes