Re: what for .bss segment?
- From: "Meindert Sprang" <mhsprang@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 12 Dec 2005 23:28:31 +0100
"#define" <u4karsh@xxxxxxxxx> wrote in message
news:1134415661.398433.62210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> But....
>
> int test;
>
> "test" will be either static or global (to be stored in .bss) with
> default value 0!!
>
> Is it not initialised with value 0???? if not, then it's fine...but if
> yes, then i've not got the ans. of my question :-(
>
> i think .bss lands in on-chip EEPROM/ FLASH.
The difference is that a const is initialized with a specified value, which
is stored in ROM. So the ROM contains a copy of every const variable. This
takes up space. A non inilialized variable is simply cleared on startup.
There is no copy in ROM for that, the startup code simply clears all the
variables in the .bss segment to 0 in a loop. That is, when you do not
modify this behaviour by changing the startup code. In many embedded
systems, this clearing is skipped because such a system would have to
recover from a reset without clearing the entire state of the device. You as
the programmer are then responsible for clearing these variables, if
necessary.
Meindert
.
- Follow-Ups:
- Re: what for .bss segment?
- From: Hans-Bernhard Broeker
- Re: what for .bss segment?
- References:
- what for .bss segment?
- From: Utkarsh
- Re: what for .bss segment?
- From: MetalHead
- Re: what for .bss segment?
- From: #define
- Re: what for .bss segment?
- From: Meindert Sprang
- Re: what for .bss segment?
- From: #define
- what for .bss segment?
- Prev by Date: Re: GNUARM tools at www.gnuarm.com
- Next by Date: Re: AT91SAM9261(-EK)
- Previous by thread: Re: what for .bss segment?
- Next by thread: Re: what for .bss segment?
- Index(es):
Relevant Pages
|