Matthias Weingart wrote:
What is the difference between data and bss segments. Which of my global
variables will reside where?
all variables in .bss are initialized with zero, those in .data are
initialized from values stored in .text
(see msp430-libc/src/stdlib/_init_section__.c if you want to look at the
initialization code)
thus, if you define a global or static variable:
int x; // -> .bss
int y = 10; // -> .data
int z = 0; // -> .data
in the last example the, value zero but despite that, its initilized and
stoted in the .data section. this means that it uses a sizeof(int) in
flash too, so if you want to save space in the flash, do not initilize
globals/statics with zero.
you can manualy put variables in the .noinit section too. these are not
initilized on startup.
chris