08-02-2020 01:02 AM - edited 08-02-2020 04:30 AM
CPU1:
Xil_SetTlbAttributes(0xFFFF0000,0x14de2);
cout<<"CPU1: Initialized."<<endl;
wfe();
cout<<"CPU1: After WFE."<<endl;
CPU0:
Xil_SetTlbAttributes(0xFFFF0000,0x14de2); cout<<"CPU0: writing start address for CPU1."<<endl; sleep(5); Xil_Out32(CPU1STARTADR, CPU1STARTMEM); dmb(); //waits until write has finished sev();
I expect after 5 seconds of CPU0's output, there will be CPU1's output. But actually, every time I run debug configuration, 3 cout strings of CPU0 and CPU1 appear instantly.
So I think that CPU1 is started automatically, how can I actually let CPU0 starts CPU1? What's more, wfe() instruction on CPU1 apparently has no effect.
Notes:
1. I have add -DUSE_AMP=1 flags in CPU1's board support package.
Now by stepping instructions on CPU1 one by one:
#elif XPAR_CPU_ID==1 /* only allow cpu1 through */ mrc p15,0,r1,c0,c0,5 and r1, r1, #0xf cmp r1, #1 beq CheckEFUSE1 b EndlessLoop1 CheckEFUSE1: ldr r0,=EFUSEStaus ldr r1,[r0] /* Read eFuse setting */ ands r1,r1,#0x80 /* Check whether device is having single core */ beq OKToRun EndlessLoop1: wfe b EndlessLoop1 #endif
OKToRun:
I find that after CPU1 executing beq OKToRun, it goes to region OKToRun. It looks like CPU1 fails to recognize that it's in a multi-core system.