--- firmware/target/arm/crt0-pp-old.S 2006-12-11 00:45:43.000000000 +0000 +++ firmware/target/arm/crt0-pp.S 2006-12-11 01:07:38.000000000 +0000 @@ -5,7 +5,7 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: crt0-pp.S,v 1.2 2006-11-22 00:49:16 dan_a Exp $ + * $Id: crt0-pp.S,v 1.2 2006/11/22 00:49:16 dan_a Exp $ * * Copyright (C) 2002 by Linus Nielsen Feltzing * @@ -102,11 +102,13 @@ /* After doing the remapping, send the COP to sleep. On wakeup it will go to cop_init */ + + /* Find out which processor we are */ ldr r0, =PROC_ID ldr r0, [r0] and r0, r0, #0xff cmp r0, #0x55 - beq 1f + beq cpu_init /* put us (co-processor) to sleep */ ldr r4, =COP_CTRL @@ -115,9 +117,15 @@ ldr pc, =cop_init -1: -#ifndef DEBUG +cpu_init: + /* Wait for COP to be sleeping */ + ldr r4, =COP_STATUS +1: + ldr r3, [r4] + ands r3, r3, #SLEEPING + beq 1b + /* Copy exception handler code to address 0 */ ldr r2, =_vectorsstart ldr r3, =_vectorsend @@ -127,15 +135,7 @@ ldrhi r5, [r4], #4 strhi r5, [r2], #4 bhi 1b -#else - ldr r1, =vectors - ldr r0, =irq_handler - str r0, [r1, #24] - ldr r0, =fiq_handler - str r0, [r1, #28] -#endif -#ifndef STUB /* Zero out IBSS */ ldr r2, =_iedata ldr r3, =_iend @@ -154,7 +154,6 @@ ldrhi r5, [r2], #4 strhi r5, [r3], #4 bhi 1b -#endif /* !STUB */ /* Initialise bss section to zero */ ldr r2, =_edata @@ -199,6 +198,19 @@ /* main() should never return */ cop_init: + /* COP: Invalidate cache */ + ldr r0, =0xf000f044 + ldr r1, [r0] + orr r1, r1, #0x6 + str r1, [r0] + + ldr r0, =0x6000c000 +1: + ldr r1, [r0] + tst r1, #0x8000 + bne 1b + + /* Setup stack for COP */ ldr sp, =cop_stackend mov r3, sp ldr r2, =cop_stackbegin @@ -209,6 +221,8 @@ bhi 2b ldr sp, =cop_stackend + + /* Run cop_main() in apps/main.c */ bl cop_main /* Exception handlers. Will be copied to address 0 after memory remapping */