[U-Boot] Relocation issue - need help!

Wolfgang Denk wd at denx.de
Wed Oct 22 14:39:29 CEST 2014


Hi,

I'm trying to track down a "syntax error" issue that gets triggered
when erasing the U-Boot image in NOR flash.  Symptoms look like this:

	=> print update
	update=protect off 0xfc000000 +${filesize};erase 0xfc000000 +${filesize};cp.b 200000 0xfc000000 ${filesize};protect on 0xfc000000 +${filesize}
	=> run update
	Un-Protected 2 sectors

	.. done
	Erased 2 sectors
	syntax error
	Protected 2 sectors
	=> run update
	syntax error

git bisect found commit 199adb6 "common/misc: sparse fixes" as
culprit; breaking this down further showed a single line in
common/cli_hush.c to trigger the problem. This patch fixes it:

---
 common/cli_hush.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cli_hush.c b/common/cli_hush.c
index 38da5a0..5bbcfe6 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -3127,7 +3127,7 @@ static void mapset(const unsigned char *set, int code)
 	for (s=set; *s; s++) map[*s] = code;
 }
 
-static void update_ifs_map(void)
+void update_ifs_map(void)
 {
 	/* char *ifs and char map[256] are both globals. */
 	ifs = (uchar *)getenv("IFS");
-- 
1.8.3.1

But I still have bad feelings - symptoms indicate that this is
actually a relocation issue, as it only gets triggered when erasing
the U-Boot image in NOR flash, so probably there are still pointers to
data in NOR being used.  This patch here is not suited to fix the
original cause of this issue.  But then, I do not see where there
might be a relocation problem.  To be sure I even verified that "ifs"
and "map[]" are really in RAM all the time.

Has anybody an idea how to further track this down?  Or is the patch
above actually a real fix?  If so, why?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Old programmers never die, they just branch to a new address.


More information about the U-Boot mailing list