Skip to contentSkip to conversation

U-boot CPU post failure on 405gp

PATCH Martin Hicks 1 participant 2 messages Mar 30, 2006 – Mar 31, 2006

lore
Share & tools
lore
#0 lore raw

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()

post/cpu/b.c +5 -1
@@ -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

Signature · 1 line
Martin Hicks || [email protected] || PGP/GnuPG: 0x4C7F2BEE
#1 lore raw
Quoted 11 lines · Martin Hicks

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:

It looks like the problem is the automatic inlining of the static function. If I declare cpu_post_test_bc as:

__attribute__((noinline))
static int cpu_post_test_bc (ulong cmd, ulong bo, ulong bi,
int pjump, int dec, int link, ulong pctr, ulong cr)

Then the test completes.
mh

Signature · 1 line
Martin Hicks || [email protected] || PGP/GnuPG: 0x4C7F2BEE