Subject: U-boot CPU post failure on 405gp

From: Martin Hicks <[email-masked]>
Date: Thu, 30 Mar 2006 16:11:43 -0500

I'm using a PPC405gp based board, and using u-boot to boot Linux.  I
recently upgraded toolchains from gcc-3.2 (some timesys build) to a
gcc-3.4.5/glibc-2.3.6 toolchain built with crosstools-0.42

Reading specs from /home/mort/src/targa/powerpc-linux/gcc-3.4.5-glibc-2.3.6/powerpc-405-linux-gnu/bin/../lib/gcc/powerpc-405-linux-gnu/3.4.5/specs
Configured with: /home/mort/src/crosstool-0.42/build/powerpc-405-linux-gnu/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure --target=powerpc-405-linux-gnu --host=i686-host_pc-linux-gnu --prefix=/opt/targa/local/powerpc-linux/gcc-3.4.5-glibc-2.3.6/powerpc-405-linux-gnu --with-cpu=405 --enable-cxx-flags=-mcpu=405 --with-headers=/opt/targa/local/powerpc-linux/gcc-3.4.5-glibc-2.3.6/powerpc-405-linux-gnu/powerpc-405-linux-gnu/include --with-local-prefix=/opt/targa/local/powerpc-linux/gcc-3.4.5-glibc-2.3.6/powerpc-405-linux-gnu/powerpc-405-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.5

The problem I'm having is when running the CPU post test on u-boot
1.1.4.  Specifically, in the branch tests.  While doing the first branch
conditional test the computer incorrectly takes the "if (link)" branch
in u-boot/post/cpu/b.c::cpu_post_test_bc()

--- a/post/cpu/b.c
+++ b/post/cpu/b.c
@@ -84,10 +84,14 @@ static int cpu_post_test_bc (ulong cmd, 
     }
     if (ret == 0)
     {
-	if (link)
+        printf("link = %d\n", link);
+        if (link)
 	    ret = lr == (ulong) code + 24 ? 0 : -1;
 	else
 	    ret = lr == 0 ? 0 : -1;
+	if (ret)
+		printf("ret = %d, link = %lx, code = %p, lr = %lx\n",
+		       ret, link, code, lr);
     }
 
     return ret;

---

Running with this small change, I get:

POST cpu link = 0
ret = -1, link = 0, code = 03fa5ab8, lr = 0

It looks clear to me that link == 0, so the test worked fine.

However, if I take away the "static" from the cpu_post_test_bc()
declaration then everything works fine.

I've posted "objdump -dS" output for post/cpu/b.o with and without
cpu_post_test_bc() declared as static at:

http://www.bork.org/~mort/ppcstatic/

Any hints appreciated.  Let me know if any other info is required.
mh

-- 
Martin Hicks || [email-masked] || PGP/GnuPG: 0x4C7F2BEE