On Fri, Mar 11, 2011 at 1:54 PM, Xiaohui Liu <[email protected]> wrote:
> Thanks for the reply. > > > On Fri, Mar 11, 2011 at 4:25 PM, Eric Decker <[email protected]> wrote: > >> >> You don't specify what platform you are building for. Please do so in >> the future it will make >> it easier to answer your question. >> >> I am working on TelosB. > > >> Most embedded processors include RAM and Flash based ROM on chip. When >> compiling the toolchain >> will tell you how much space it thinks your program has taken up in code >> space (ROM, really flash) and >> how much in RAM. >> >> On Fri, Mar 11, 2011 at 12:23 PM, Xiaohui Liu <[email protected]> wrote: >> >>> Hi, >>> >>> When I build my application, it says >>> 47652 bytes in ROM >>> 9426 bytes in RAM. >>> What exactly consists of the content in ROM and RAM? >>> >> >> >>> Where are global variables stored, ROM or RAM? >>> >> >> if a global variable is listed as "const" it goes in ROM. >> >> What variables are "const"? Do you mean using keyword "const" when > declaring the variable? > yes. If a global variable is declared const it gets put into rom. 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. >> >> >>> What is the resulting .ihex file? >>> >> >> I don't know what you are trying to ask. I don't understand the question. >> > I mean what is in the main.ihex generated? What is the file for? > Beats me. It is an artifact of the makefile. Perhaps I should remove it. I am currently doing major work on cleaning up the msp430 part of the tree. None of the tools currently need it for what they do. All of the current tools that I know of use the elf output directly. But I'll check into that. > >> >> >>> According to this >>> thread<http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2008-August/035680.html>, >>> data and global variables are in RAM, what are the "data" here, can anyone >>> give some examples of such data? >>> >> >> That thread talks about the micaz which is an Atmel processor. Is that >> the processor you are building for? >> >> No, I'm building for msp430. > Okay. So you should then keep in mind that thread referes to the Atmel processors and doesn't really apply to what we are taking about. > "data" refers to initilized data. See above. Other global variables get >> put into bss and is zero'd. >> >> If you want to see the layout of your program you can use one of the >> toolchain programs. For the msp430 these are >> msp430-nm and msp430-objdump. Play with them and see what is there. >> >> >>> >>> When a program is downloaded into a mote, where is it stored? >>> >> >> The code is flashed into ..... the flash. This is the ROM. And then >> typically there is a reset vector that determines >> the first PC (PC= program counter, not personal computer, in this context) >> and the program begins to execute. What >> happens next depends on the instructions but typically bss will get zero'd >> and data will get copied down from ROM into >> the appropriate RAM area. >> >> If power is lost, yes the RAM gets lost. >> >> >>> Is data stored in RAM? If yes, will it be lost if mote is powered off >>> just like all data in memory is lost when a PC is turned off? >>> >>> The controller fetches code instructions from ROM and data from RAM when >>> executing a program, is this understanding right? >>> >> >> Depends on the instruction being executed. >> >> I would recommend you find a reasonable introduction to how computers work >> at the lower layer. I don't know one off the top >> of my head. Try a google search for "How do CPUs work". >> >> >>> >>> Thanks for your clarification. I wish I could organize these random >>> questions in a more systematic manner. >>> >> >> See how much you can figure out on your own first. Do as much homework as >> you can first. But keep in mind >> getting pointed in the right direction can be very very helpful too so >> keep it balanced. >> >> eric >> >> >>> -- >>> -Xiaohui Liu >>> >>> _______________________________________________ >>> Tinyos-help mailing list >>> [email protected] >>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >>> >> >> >> >> -- >> Eric B. Decker >> Senior (over 50 :-) Researcher >> >> >> > > > -- > -Xiaohui Liu > -- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
