Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHi bkucera & Jesse,
> > So how does the .bss section get allocated in memory if the sections that refer to > > it in the ELF file don't make it into the .flash file? The linker groups all .bss input sections into the .bss output section and assigns addresses to the symbols that end up in the .bss output section. So, the linker allocates the memory -- or maybe better -- the linker reserves/assigns the address range occupied by .bss (as well as the other sections). Your executable code (.text) and sometimes your initialized data (.data -- e.g. a pointer to a buffer in .bss that has an initializer such as: unsigned char *p = mybuf) refer to .bss -- and sections that contain initialized data make it into the flash file (the LOAD attribute is set). After initialization, accessing data in .bss is the same as accessing data in any other section (ignoring .sbss and .sdata). So the only practical difference between .data and .bss is: .data is initialized by copying an image into the memory and .bss is initialized by clearing the memory. > I think the .elf just leaves this... blank. Again, crt0 has to know where the bss > is to initialize it. Correct. Take a look at objdump output. The size of the .bss elf file section is zero. crt0 knows the start and end address of .bss based on the symbols __bss_start and __bss_end which are provided by the linker. You can find these symbols in the linker command file (generated.x) -- which is in the system_description directory in your syslib build tree. Regards, --Scott