Cypress技术论坛
直播中

贾玲

7年用户 184经验值
私信 关注
[问答]

怎么从主C代码中调用函数

您好!
使用CY8C27 43-24PXI和C.开发代码
在这一点上,我想从主C代码中调用函数,并希望在汇编中编写函数。
请建议我怎么做。
当做,

以上来自于百度翻译


     以下为原文
  Hi
    I am using CY8C27443-24PXI and developing code in C.
    At this point I want to make function call from main C code and I want to write function in assembly.
    Please suggest how can I do it.
    Regards,

回帖(2)

陈娟

2019-3-29 11:13:31
当您在程序集中声明函数时,请确保在函数名前面附加“y”。当你在函数名前面加上“y”时,你可以从C文件中调用函数。下面给出的例子首先导出了其他程序集和C文件的函数。“C MySimultRead”是用于C文件和“MySimultRead”的,用于汇编文件。同样,在定义的时候,我们必须使用两个名称来使这个名称既可用于汇编程序,也可用于C文件。
请注意,从C文件中,也只能调用名为MySimultSead的函数。
导出yMyStudio启动
导出MyStudio启动
StaseStEnSyStRe::StaskSnSeSyStEng:您的函数代码RET一旦完成,就可以在头文件或要调用该函数的C文件中给出函数的原型。最好的问候,Pushek

以上来自于百度翻译


     以下为原文
   When you are declaring the function in assembly then make sure you have "_" appended in front of the function name. When you are appending "_" in front of the function name then you can call the function from C files. An example given below first of all exports the function for other assembly and C files.  "_MyFunc_Start" is for the C files and "MyFunc_Start" is for assembly files. Similarly at the time of definitiion as well, we have to use two names to make this name accessible to both assembly and C files.
    Please note that from C file as well, you have to call the function with name MyFunc_Start only.
     
     
    export _MyFunc_Start
    export  MyFunc_Start
            
            
               SmartSense_Start:    
          _SmartSense_Start:    
               
               
          ; Your function code    
               
          ret    
               
          Once done, you can give the prototype of the function in a header file or the c file in which you want to call this function.    
               
               
          Best regards,    
          Pushek    
   
举报

陈娟

2019-3-29 11:21:00
当您在程序集中声明函数时,请确保在函数名前面附加“y”。当你在函数名前面加上“y”时,你可以从C文件中调用函数。下面给出的例子首先导出了其他程序集和C文件的函数。“C MySimultRead”是用于C文件和“MySimultRead”的,用于汇编文件。同样,在定义的时候,我们必须使用两个名称来使这个名称既可用于汇编程序,也可用于C文件。
请注意,从C文件中,也只能调用名为MySimultSead的函数。
导出yMyStudio启动
导出MyStudio启动
MySimultStult:YMyMaluxStList:您的函数代码RET一旦完成,就可以在头文件或要调用该函数的C文件中给出函数的原型。最好的问候,Pushek

以上来自于百度翻译


     以下为原文
    When you are declaring the function in assembly then make sure you have "_" appended in front of the function name. When you are appending "_" in front of the function name then you can call the function from C files. An example given below first of all exports the function for other assembly and C files.  "_MyFunc_Start" is for the C files and "MyFunc_Start" is for assembly files. Similarly at the time of definitiion as well, we have to use two names to make this name accessible to both assembly and C files.
     
    Please note that from C file as well, you have to call the function with name MyFunc_Start only.
     
     
    export _MyFunc_Start
    export  MyFunc_Start
            
            
               MyFunc_Start:    
          _MyFunc_Start:    
               
               
          ; Your function code    
               
          ret    
               
          Once done, you can give the prototype of the function in a header file or the c file in which you want to call this function.    
               
               
          Best regards,    
          Pushek    
   
举报

更多回帖

发帖
×
20
完善资料,
赚取积分