Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 1 > Assembly and C

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Assembly and C
Moderator:
ARVI

Post Reply
Follow this topic



Assembly and C

PSOC_Canada posted on 23 Sep 2011 7:34 AM PST
Senior Member
15 Forum Posts

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,

 




Re: Assembly and C

pmad posted on 25 Sep 2011 10:19 PM PST
Cypress Employee
154 Forum Posts

 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



Re: Assembly and C

pmad posted on 25 Sep 2011 10:20 PM PST
Cypress Employee
154 Forum Posts

  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






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20