Bss Section Vs Data
Would be contained in the bss segment.
Bss section vs data. Typically only the length of the bss section but no data is stored in the object file. This behavior can be overriden by using the pragma explicit zero data results compiling a c file using codewarrior 5 1. The program loader allocates memory for the bss section when it loads the program.
The bss segment also known as uninitialized data is usually adjacent to the data segment. That name comes from the old unix assembler and you won t find a text data and bss in the segment names generated by the keil tools. The data section will contain the initialised global and static variables.
Bss is for the uninitialized data in ram which is initialized with zero in the startup code. For instance a variable defined as static int i. The bss segment contains all global variables and static variables that are initialized to zero or do not have explicit initialization in source code.
By placing variables with no value in the bss section instead of the data or rodata section which require initial value data the size of the object file is reduced. Data is for initialized variables and it counts for ram and flash. By default zero initialized data is put into the bss section by the compiler zeroed by init code.
Initialized data or simply data segment stores all global static constant and external variables declared with extern keyword that are initialized beforehand. Bss will contain un initialised global and static variables. But pedantry aside the bss section traditionally is that section that contains all the uninitialized variables which according to spec must be set to.
Uninitialized data or bss segment contrary to initialized data segment uninitialized data or bss segment stores all uninitialized global static and external variables declared with extern keyword. Bss refers to uninitialized global and static objects and data refers to initialized global and static objects. To be picky keil c doesn t have a bss section.