TLB Miss booting linux kernel on ppc 405

David Baird dhbaird at gmail.com
Thu Feb 14 06:02:09 EST 2008


On Feb 13, 2008 11:49 AM, Ricardo Ayres Severo <severo.ricardo at gmail.com> wrote:
> Executing without single step the exception doesn't occurs. But at
> __log_buf I get only trash, even after reseting the processor.
> How can I send some characters to uartlite on asm code?

Great.  This confirms that I am not crazy.  You are having similar
results as I did.  But I still don't yet know why single-step and
memory read can't be used in virtual mode...

To use UARTLite, there are some patches you need.  First thing, you
have to setup your TLBs so that uartlite can be accessed in virtual
mode.  I did something like this:

#define MY_UART_LITE_BASE 0x40000000

 lis r3,MY_UART_LITE_BASE at h
 ori r3,r3,MY_UART_LITE_BASE at l
 mr  r4,r3
 clrrwi  r4,r4,12
 ori r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)

 clrrwi  r3,r3,12
 ori r3,r3,(TLB_VALID | TLB_PAGESZ(PAGESZ_16M))

 li  r0,0      /* TLB slot 0 */
 tlbwe r4,r0,TLB_DATA
 tlbwe r3,r0,TLB_TAG

Then, you need to add some C code somewhere.  I chose "setup.c" (in
same directory as head_4xx.S) for this purpose:

// Try to get value for XPAR_RS232_UART_BASEADDR:
#include <platforms/4xx/xparameters/xparameters.h>
#include <platforms/4xx/xparameters/xparameters_ml403.h>

void
serial_putc(unsigned char c)
{
 while (((*(volatile uint32_t*)(XPAR_RS232_UART_BASEADDR + 0x8)) & 0x08) != 0);
 *(volatile uint32_t*)(XPAR_RS232_UART_BASEADDR + 0x4) = c;
}

void
print_A()
{
 serial_putc('A');
}

void
print_B()
{
 serial_putc('B');
}


Now, from assembly, things are easy.  Just do this, I think:

 blr print_A
 blr print_B

If this gives you any trouble, try it first from real mode so that you
can easily debug it.

-David


More information about the Linuxppc-embedded mailing list