[U-Boot-Users] static variables in u-boot.

mushtaq khan mushtaqk_921 at yahoo.co.in
Fri Apr 20 12:31:15 CEST 2007


Hi Leonid,

  
I don’t thing it is a problem with static or global pointers. It is something to do with relocation of a section .rodata  which holds string constants like “U-Boot 1.1.3” .
I faced a similar problem, I had NOR (boot flash) and NAND flash sharing EBC pins. That is  either I can use NOR flash or NAND flash but not both at the same time.When I gave the EBC pin’s control to NAND flash, u-boot used to crash.
I found that it use to crashing at the line
static const char *l = "xwr";
In this case string used to be in .rodata section.
And i  found that pointer “l” is pointing to a location that is of the NOR flash, which means relocation from boot flash (i.e. NOR) to SDRAM didn’t happen for all the sections.

I didn’t know how to fix this issue in Linker descriptor file.
But I had alternate solution that is, I replaced the above 
code with:
static const char l[] = "xwr";
In this case string “xwr” was in .data section.

  Thanks,
-Mushtaq Khan



Leonid <Leonid at a-k-a.net> wrote:


 Hi:

Because u-boot reallocates itself, static/global variables cannot be
freely used there - if something is initialized using pointers on such
variables, they actually points to wrong addresses (may be on flash)
after reallocation.

What is simplest way to fix this problem - surely many people have
bumped into that?

U_BOOT_CMD macro kind of does the trick for entries of u-boot CLI, but
when I tried to mimic this logic buy organizing special section for my
variables, I have here and there, it didn't work. Probably I miss
something.

Does anybody have a suggestion?

Thanks,

Leonid.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


       
---------------------------------
 Check out what you're missing if you're not on Yahoo! Messenger 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070420/f50c1ea3/attachment.htm 


More information about the U-Boot mailing list