A undefined instruction exception appeared when I'm using MDK to make a user bin,and run with my bootloaser! I use a s3c2440 micro chip. in my .c:
void ChangeClockDivider(int hdivn_val,int pdivn_val) //14 12 { int hdivn=2, pdivn=0; hdivn=2 ; if(pdivn_val==12){ pdivn=1; }else if(pdivn_val==11){ pdivn=0; } rCLKDIVN = (hdivn<<1) | pdivn; // MMU_SetAsyncBusMode(); //If I invalid this ,no undefined instruction exception happens but i didnot means to do it. }
in my asm,I code follow the datasheet of s3c2440:
EXPORT MMU_SetAsyncBusMode MMU_SetAsyncBusMode mrc p15,0,r0,c1,c0,0 orr r0,r0,#R1_nF:OR:R1_iA mcr p15,0,r0,c1,c0,0 MOV_PC_LR END
I don't know if it is caused by MDK syntax rules error. Or something else?
Can you use a debugger, and step into the problem code, and review the disassembly?
Which instruction specifically choking?
Is the processor in user/system mode at the failure point?