Author Topic: Compiler (Assembling) error lpc1768  (Read 10184 times)

Offline Prakash

  • Newbie
  • *
  • Posts: 17
    • View Profile
Compiler (Assembling) error lpc1768
« on: October 26, 2010, 11:41:59 AM »
Hello,

I am new to the assembly code. The code which I given below is compile(assembling) fine in KEIL.

AREA |.text|, CODE, READONLY

EXPORT vF_dspl_pid

vF_dspl_pid
push {r4-r7}

ldrsh Kp,[pS_StateCoeff]
ldrsh Ki,[pS_StateCoeff,#2]
ldrsh Kd,[pS_StateCoeff,#4]
ldrsh IntegratedError,[pS_StateCoeff,#6]

mla Acc,Ki,si_Error,IntegratedError //update integrated error
strh Acc,[pS_StateCoeff,#6] //store to state

ldrsh LastError,[pS_StateCoeff,#8]
strh si_Error,[pS_StateCoeff,#8]

mla Acc,Kp,si_Error,Acc //add in proportional part

sub Temp,si_Error,LastError
mla Acc,Kd,Temp,Acc //add in the difference part

mov Acc,Acc,ASR#16 //scale down to short int
pop {r4-r7}
bx lr

END


But when I switch from KEIL to ROWLEY CROSS WORKS. The foolowing errors are getting during assembling.

Error: bad instruction 'area |.text|,CODE,READONLY'

Error: bad instruction 'export vF_dspl_pid'

Error: bad instruction 'vf_dspl_pid'

Error: Thumb does not support this addressing mode -- 'ldrsh r3,[r1]'

Error: Thumb does not support this addressing mode -- 'ldrsh r4,[r1,#2]'

Error: Thumb does not support this addressing mode -- 'ldrsh r5,[r1,#4]'

Error: Thumb does not support this addressing mode -- 'ldrsh r6,[r1,#6]'

Error: Thumb does not support this addressing mode -- 'ldrsh r6,[r1,#8]'

Error: shifts in CMP/MOV instructions are only supported in unified syntax -- 'mov r7,r7,ASR#16'

Error: bad instruction 'end'
Build failed


Kindly give me suggession to get out of these errors.

-Prakash

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
    • uTasker
Re: Compiler (Assembling) error lpc1768
« Reply #1 on: October 26, 2010, 12:42:40 PM »
Hi

Keil and GCC assembler syntax is not the same so it is not possible to assemble a Keil assembler file using GCC (Rowley Crossworks).
What you need is a GCC assembler reference to compare with and the changes needed may be obvious - also try looking at pseudo-assembler generated by GCC (or a disassemble view when debugging).

Regards

Mark