From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Mon, 06 Nov 2006 13:46:43 -0600 Subject: [U-Boot-Users] Why are some global vars part of the image, and some not? In-Reply-To: <454F879E.9020803@smiths-aerospace.com> References: <20061104020417.69640352658@atlas.denx.de> <454F7440.5030709@freescale.com> <454F78D6.6020805@smiths-aerospace.com> <454F7A30.9030100@freescale.com> <454F8373.1000300@smiths-aerospace.com> <454F854B.9000402@freescale.com> <454F879E.9020803@smiths-aerospace.com> Message-ID: <454F9123.4050706@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Jerry Van Baren wrote: > Does the linker create proper zero initialization? Yes. > Does the bss/data end up in the right place? It ends up where nonzero-initialized data currently is (i.e. in flash before relocation, in RAM after). > 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? I don't follow what, specifically, you mean by "initialized portion". The data section contains data which is statically initiallized at compile/link time; the only difference is that it would now include data whose initial value is zero. Some pieces of data will be further "initialized" at runtime by U-Boot code; this, of course, must happen after SDRAM is initialized (and U-Boot has relocated to it), but that has nothing to do with moving the BSS into the data segment. The BSS is purely an optimization; besides increasing flash footprint somewhat, removing it should not change anything except for code that was already broken. > Simple enough things to experiment with, but it all takes time and the > benefit is questionable. Feel free to prove us curmudgeons wrong. ;-) The main things that would take effort are changing all the board linker scripts, and finding large BSS allocations and changing them to be dynamically allocated so they don't take up space in flash. The benefit is that bss-related bugs in the pre-RAM code go away and stay away, and that ugliness such as having to specify __attribute__ ((section ("data"))) whenever the value is zero also goes away. -Scott