On Sun, Mar 13, 2011 at 8:09 AM, Xiaohui Liu <[email protected]> wrote:
> >> yes. If a global variable is declared const it gets put into rom. >> > > What about global variables not declared as "const"? Where are they > stored? > If initilized, a global variable is put into the "data" section and the initilized value gets put into the initilizer block that is stored in ROM. ie. say we have a global uint16_t xyz. xyz will be located in the "data" section and 2 bytes in the ROM will be allocated and will hold the value that xyz should be initilized to. The data initilizer is copied into RAM by the start up code before main gets called. ie. uint16_t xyz = 0x5412; 0x5412 will be stored in the ROM and gets copied down by the start up code. If uninitilized the variable is allocated in ".bss" section. Which gets zero'd by the start up code. > >> If a parameter to a function or a local variable is declared const it >> simply tells the compiler not >> to allow any writes to that object. >> >> >>> >>> If a global variable is initilized it goes into ".data" and there is a >>>> block of ROM that contains all the initilized data values. >>>> On start up this block is copied into the .data section that actually >>>> lives in RAM. >>>> >>>> If a global variable isn't initilized then it goes into the ".bss" >>>> section. It gets zero'd on start up. The name is ancient and comes >>>> from an old old old (maybe before you were born, gosh that's fun to say) >>>> IBM assembler directive. BAL (Basic Assembly Language). >>>> >>>> >>>>> What is .bss? >>>>> >>>> >>>> Google is your friend. I did a simple google search for "what is .bss" >>>> and got the answer. But that doesn't answer the question >>>> in the context you are asking. I don't know what to point you at. >>>> This is stuff I've picked up over the years. Probably by asking someone. >>>> Also I was in on this stuff when it was happening the first time. Sorry I >>>> don't have a better answer. >>>> >>> -- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
