"Error: operand out of range" when using PPC assembler
I have bulit gcc cross compiler/assembler/linker with 'powerpc-eabi' as TARGET in windows using cygwin. When assembling, I am getting the following error ....
code/sfiles/init_evh.s: Assembler messages:
code/sfiles/init_evh.s:381: Error: operand out of range (0x0000fffd is not between 开发者_JAVA技巧0xffff8000 and 0x00007fff)
But, in that line number, the following instruction is there:
addi r2,0,0xFFFD
I am using the follwing command for assembly:
c:/cygwin/home/cdot/powerpc/bin/powerpc-eabi-as -mbig-endian -m603 -mregnames --
defsym _NDI_=1 --defsym _DBGR_ON_=1 --defsym DEBUG=1 --defsym _PARAM_DEBUG_=1 --
defsym _NIU_=1 -gdwarf-2 -I code/hfiles -o build/niu_ndi_dbgr_init_evh.o code/sf
iles/init_evh.s 2>build/niu_ndi_dbgr_init_evh.err
I would like to know why the above error appear.
Please help in this direction.
The compiler/assembler is correct in emitting an error message here. The use of a constant 0xfffd
is not possible with immediate-type instructions in PPC assembly.
PowerPC immediate instructions (such as the addi
you're attempting to do) have a generic instruction format 6/5/6/16 bits each for opcode/source/dest/constant; the 16bit constant is signed, hence the range is -32768 ... 32767
; this is sign extended to 32bit, which means you'll get a range of 0xffff8000 ... 0x7fff
. See also:
IBM Developerworks PPC Assembly Introduction, particularly "listing 3."
That's what the error message is trying to tell you.
精彩评论