I want to insert inline assembly for following statements .I have used __asm directive but it gives error messege mrs r4, CPSR orr r4, r4, #0xC0 msr CPSR, r4 kindly advice
You need to make sure that the inline assembly code within the function uses the correct mode: either ARM or Thumb, default is Thumb and that's why you get the errors since you are using ARM instructions. You can override the function mode with __arm or use #pragma ARM to change it. Take a look at the following example:
// #pragma ARM // would do the same as __arm below ! void ChangeIRQ (unsigned int NewState) __arm { // use ARM-mode for this function __asm { AND R0,R0,#0 // MRS R0,CPSR // ORR R0,R0,#0x80; // LDAV R1,R10,NewState // load parameter-value 'NewState' into R1 BIC R0,R0,R1,LSL #7 // MSR CPSR_c, R0 // } }