以下是TI给我的回复:<br />Regarding your inquiry, To call a C subroutine from assembly you have to follow below mentioned steps:<br /> <br />1) Declare and define the C subroutine in a .c file<br /> <br />2) To access a C function or object from assembly language, declare the C object with <br />.global or .ref. This creates an undeclared external reference that the linker resolves. <br /> <br />3)When you call a C function from assembly language, push any arguments onto the stack in <br />reverse order. Pop them off after calling the function.<br /> <br />4) The compiler adds an underscore ( _ ) to the beginning of all identifiers(that is, <br />labels). In assembly language modules, you must use an underscore prefix for all objects <br />that are to be accessible from C. For example, a C object named x is called _x in <br />assembly language. So if you have to call the C subroutine "func_c" in assembly then <br />declare the subroutine as .global _func_c and then call the subroutine.<br /> <br />5)Functions must return values in the accumulator. 16-bit integer values and pointers <br />must be loaded in the accumulator with proper sign extension.
|