Skip to contentSkip to conversation

ppc-linux still not booting on my virtexII board

DISCUSSION Patrick Huesmann 2 participants 4 messages Aug 25, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I traced down the problem a little further. Apparently the machine crashes on certain memory accesses.

early_init() in arch/ppc/kernel/setup.c calls memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start) to zero out the BSS section. I substituted memset_io with my own memset function and found out that the given parameters are ok, according to the symbol table. I then made up a "debug memset" like this:

void mymemset(char *ptr, int c, int len)
{
while (len--) {
<code that waits for uart rx> hexout((int)ptr); // print the current address *(ptr++) = c;
}
}

then I found that the board crashes always at the same address (c00931c0), that is 0x01c0 bytes in the BSS section (which begins at c0093000).

Then I incremented "ptr" by a fixed offset (0x80) at the beginning of mymemset(), to find out that the cpu then crashes when writing to the exact same location c00931c0 (therefore one could think that it depends on the absolute address, not on the number of bytes written).

Now it's getting weird. Assuming that there is something wrong with the memory bus or memory controller, I wrote to that address using my (homegrown) ROM monitor. But that is no problem and I would read back the correct values from that address. The only difference is that the ROM monitor uses no MMU (therefore I used 0x000931c0 instead of 0xc00931c0).

One could argue that there is something wrong with the initial MMU, but then I can't think of a reason why it should happen at such a "odd" address.

Then there is a possibility of cache problems. Someone on this list suggested that I better flush the caches before booting, using a code snippet like this:

for(i=0; i<16384; i+=32) {
asm("dccci 0,%0" :: "r"(i));
}
asm("iccci 0,0");
asm("sync;isync");

Ok, i inserted this code snippet at the beginning of early_init(), and then BANG! the board crashed immediately.

I reproduced the memset() thing with both the denx kernel tree and the kernel port for memec V2P eval board, supplied by the kind people at mind.be.

The kernel versions are 2.4.25 and 2.4.22, respectively. My toolchain is a powerpc-405-linux-gnu- with gcc version 3.3.2, which I downloaded in binary form at
http://developer.osdl.org/dev/plm/cross_compile/powerpc-405-linux-gnu.tar.bz2
(I suspect that it's a crosstool generated one).

Perhaps someone who knows this weird processor better than me, can shed some light? I'm no dumbass when it comes to the low level stuff, but I only know some ARMs and PICs in this detail and this is my very first PPC project. Thank you very much.

Regards,
Patrick

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 9 lines · Patrick Huesmann

Then there is a possibility of cache problems. Someone on this list suggested that I better flush the caches before booting, using a code snippet like this:

for(i=0; i<16384; i+=32) {
asm("dccci 0,%0" :: "r"(i));
}
asm("iccci 0,0");
asm("sync;isync");

You should probably invalidate the cache before you flush it. There is code to do this for the ML300. Search for "mfdccr" in:

http://ppc.bkbits.net:8080/linuxppc-2.4/anno/arch/ppc/boot/simple/[email protected]?nav=index.html|src/|src/arch|src/arch/ppc|src/arch/ppc/boot|src/arch/ppc/boot/simple

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#2 lore raw

Hi,

Quoted 4 lines

You should probably invalidate the cache before you flush it. There is code to do this for the ML300. Search for "mfdccr" in:

http://ppc.bkbits.net:8080/linuxppc-2.4/anno/arch/ppc/boot/simple/[email protected]?nav=index.html|src/|src/arch|src/arch/ppc|src/arch/ppc/boot|src/arch/ppc/boot/simple

Quoted 1 line

Thanks.
After digging in the data sheets, I noticed that the address where the access fails (0x000931c0) is a boundary between cache lines. Don't know if that means something, though.

Regards,
Patrick

--
NEU: Bis zu 10 GB Speicher für e-mails & Dateien! 1 GB bereits bei GMX FreeMail http://www.gmx.net/de/go/mail

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to Scott Anderson

Hi,

Quoted 1 line

(...)arch/ppc/boot/simple/embed_config.c

Oops, I skipped that code because my bootloader executes the uncompressed kernel image (loaded at 0x00000000) without doing that stuff in the first place. All right ;)

Thanks again,
Patrick

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/