Wednesday, February 23, 2011

Data segment in C


Data segment in C is broadly classified in 4 sections: ".txt" , ".rodata" , ".bss" , ".data"

.rodata:The .rodata is also used for storing string constants and read only data's.
.data:The compiler places initialized and uninitialized global variables in the .data section.
.bss: A separate section called .bss is used for uninitialized variables or temporary variable in stack
.txt: Opcode i.e executable code is stored in this section.


Note:Flash content cannot be modified, it can only be erased and re-written hence code and constants are stored in flash while variables are stored in RAM.

Print

2 comments:

  1. HI, Vig. what would u like to convey by the word FLASH in above figure.

    ReplyDelete
  2. Hi,

    Since i am writing about C for microcontroller programming, flash refer's to flash in that microcontroller.
    Eg: LPC2148 has 512 kB of flash

    ReplyDelete

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger | Printable Coupons
Design Downloaded from Free Blogger Templates | Free Website Templates