
Hi,
On 9 July 2016 at 11:27, André Przywara andre.przywara@arm.com wrote:
On 09/07/16 15:38, Simon Glass wrote:
On 8 July 2016 at 08:18, Andre Przywara andre.przywara@arm.com wrote:
As printf calls may be executed quite early, we should avoid using any BSS stored variables, since some boards put BSS in DRAM, which may not have been initialised yet. Explicitly mark those "static global" variables as belonging to the .data section, to keep tiny-printf clear of any BSS usage.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Reviewed-by: Simon Glass sjg@chromium.org
Another approach would be to put these vars in a struct, declare it as a local variable and pass it around. But this works OK too.
Yeah, I was thinking about this too. Actually fixing the issue that we need global variables in the first place. But a quick look revealed that this is not trivial, so I reverted to this simpler approach for the quick fix. Also I am not sure this will eventually work against this "tiny" idea, we will see.
To be honest I think the real proper fix(TM) would be to provide a separate BSS section for any code that runs _before_ DRAM init. This should be a few bytes only and could easily live in SRAM. If the loading part of the SPL requires a bigger BSS, that's fine as it could still live in DRAM. I might bake a patch when I get bored ...
For reference I sent a patch to remove use of the data section:
http://patchwork.ozlabs.org/patch/656024/
Cheers, Andre.
Regards, Simon