Re: what for .bss segment?



"#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


.



Relevant Pages

  • Re: BBC Basic and ZX CF
    ... > clear memory high load it there and then RAND USR to that memory block and ... No, 'cos the thing about a ROM is, well, it's a ROM. ... The startup code at &0000 prods the I/O to ... see what ROM paging hardware is present to find itself and the BBC ...
    (comp.sys.sinclair)
  • Re: Anyone have a memory test program for Z80 based S-100?
    ... : 48(flush biffers) added. ... Source exists for the PCP/M-80 BDOS, and one of the equates is 'data_low'. ... If this is set, it looks like the BDOS ends up in ROM, and LDIRs its ... startup code will be needed to perform the cold boot functions that ...
    (comp.os.cpm)
  • Re: Anyone have a memory test program for Z80 based S-100?
    ... >: 48(flush biffers) added. ... >If this is set, it looks like the BDOS ends up in ROM, and LDIRs its ... startup code will be needed to perform the cold boot functions that ... > The Philips:YES is supposed to have DOS Plus in ROM; ...
    (comp.os.cpm)
  • Re: Samsung S3C4510B Memory Remapping
    ... >the ROM to SRAM after remapping? ... Actually the C startup code should do this for you. ...
    (comp.arch.embedded)