hello while using MUL(Thumb)instruction in the keil i am getting the error: A1477W: This register combination results in UNPREDICTABLE behaviour,the code written is given below
area th,code entry THUMB mov r0,#0x12 mov r1,#0x02 mul r1,r0 loop b loop end
So can anybody give me the reason and solution how to recover from this error...
My previous answer was wrong. That restriction is not for your case :) I don't know which uC do you use and I cannot test right now, but try using MULS r1,r2,r1 instead of MUL r1,r2 and see if that works
i am using lpc2129,and muls r0,r1,r2 is an arm instruction not thumb
If you have made an effort to read what Andy Neil suggested: http://www.keil.com/support/man/docs/armasm/armasm_cihihggj.htm you would read this: Thumb instructions
The following form of the MUL instruction is available in pre-Thumb-2 Thumb code, and is a 16-bit instruction when used in Thumb-2 code:
MULS Rd, Rn, Rd Rd and Rn must both be Lo registers.
LPC2129 is ARM7TDMI-S based which is pre-Thumb-2.
And the instruction is MULS R1,R2,R1 (do you see the difference?) where R1 is also your destination register
Yes, that is what I was hinting at when I said,
"Note that there is a restriction stated there on which registers may be used in the Thumb instruction..."