This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Linux
I want to write the equivalent inline assembly code for the below C code
It should support ARMv7-a and GNU v5.3.1 (LInaro)
if (low >= 0x01)
{
low -= 0x01;
propagate_carry(ptr);
}
Here ptr is any pointer.
Can someone help me out with this?
I tried like this :
__asm
(
"SUB %[input_low], #0x01 \n"
"MOV eax, %[Input1] \n"
"PUSH eax \n"
"CALL propagate_carry \n"
"POP ebx \n"
: [Input1] "=m" (ptr), [input_low] "=r" (low)
);
While building on CCS 6.2 it is throwing errors :
/tmp/ccDdqZ7X.s: Assembler messages:
/tmp/ccDdqZ7X.s:1565: Error: ARM register expected -- `mov eax,[fp,#-16]'
/tmp/ccDdqZ7X.s:1566: Error: expression too complex -- `push eax'
/tmp/ccDdqZ7X.s:1567: Error: bad instruction `call propagate_carry'
/tmp/ccDdqZ7X.s:1568: Error: expression too complex -- `pop ebx'
Hello Mona,
try this:
preserve asm listing after compiling and analyze code generated by the C compiler.
Use no optimization and max for speed optimization and compare both assembly codes.
If you you find the way how to program your case somehow better that can be done by the C compiler, let me know.
Hi Tomasz,
Thank you for quick reply.
I tried the way you suggested me but not able to figure out how to pass the function argument while calling the C function in __asm ().
And I also want to know how to access the pointer and structure members in inline assembly code .
If you can share some snippets to explain me this .. it would be very helpful to me and very appreciated.
Thanks.
Hi Mona,
Mona Shree said:but not able to figure out how to pass the function argument while calling the C function in __asm ().
Refer to http://www.ti.com/lit/ug/spnu151r/spnu151r.pdf and parts of RTE chapter.
Mona Shree said:If you can share some snippets to explain me this ..
I have no example code calling a C function from an assembler code.
Check this: 6.4 Function Structure and Calling Conventions within the above document.