Hi,
After initializing and enabling the MMU I enable both the I- and the D-cache. However, having executed a few of the succeeding instructions(see below), the program ends up at a wrong address.
The following code is executed after having generated translation tables for GPMC, On-Chip memory, peripherals, SDRAM and EMIF. It looks like the program is executed correctly if the lines enabling the I- and the D-cache are commented out.
/* Invalidate the TLB. */ __asm __volatile ( "mcr p15, 0, r0, c8, c7, 0 \n" ); /* Set table base register. */ __asm __volatile ( "ldr r0,=__MMU_TABLE_START \n":::"r0" ); __asm __volatile ( "mcr p15, 0, r0, c2, c0, 0 \n" ); /* Set domain 0 access rights to "client". Client = use MMU translation table access right settings. */ __asm __volatile ( "mov r0, #0x00000001 \n":::"r0" ); __asm __volatile ( "mcr p15, 0, r0, c3, c0, 0 \n" ); /* Enable MMU. */ __asm __volatile ( "mrc p15, 0, r0, c1, c0, 0 \n":::"r0" ); __asm __volatile ( "orr r0, r0, #0x1 \n":::"r0" ); __asm __volatile ( "mcr p15, 0, r0, c1, c0, 0 \n" ); /* Enable I- and D-cache */ __asm __volatile ( "mrc p15, 0, r0, c1, c0, 0 \n":::"r0" ); __asm __volatile ( "orr r0, r0, #0x1000 \n":::"r0" ); /* Enable I-cache */ __asm __volatile ( "orr r0, r0, #0x0004 \n":::"r0" ); /* Enable D-cache */ __asm __volatile ( "mcr p15, 0, r0, c1, c0, 0 \n" ); /* Set up and enable hardware timer. */ CM_CLKSEL_PER &= ~CLKSEL_GPT2; CM_FCLKEN_PER |= EN_GPT2; CM_ICLKEN_PER |= EN_GPT2; /* Initialize tick interval. */ GPTR2_TCLR = 0; /* <--- Program crashes here */
Is there something else I have to initialize or what am I missing?
Thanks in advance,
Nicklas