
Scott Wood wrote:
Jerry Van Baren wrote:
In theory, yes. In practice, I have my doubts that it is workable, let alone a better way. Writing "then the compiler would be the one that zeros BSS" is easy, actually making it work may be tricky.
It's a pretty simple linker script change, actually. Just move all of the lines within .bss {} into .data {}. Where do you see the difficulty coming from?
-Scott
Does the linker create proper zero initialization? If you initialize a variable to zero, the compiler puts it in bss and does not initialize it, secure in the knowledge that the runtime zeroes bss. If you subsequently put it in the data section via the linker script, does it get zeroed?
Does the bss/data end up in the right place? On start up your stack is in cache or dual-port RAM until SDRAM is initialized. When does the initialized portion of the data section get initialized and where? Before it is in SDRAM or after SDRAM is initialized?
Simple enough things to experiment with, but it all takes time and the benefit is questionable. Feel free to prove us curmudgeons wrong. ;-)
gvb