UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
1,069 Views
Registered: ‎08-18-2017

Mix C and assembly Code

Hello guys , I would like to find a tutorial or example on how to mix C and Assembly code for the Cortex-A9 from the SDK . 
I have done that many times but on KEIL (which still uses ARM GCC compiler and ARM Assembler) , but its not working for Xilinx SDK . 
Simply I wanna define header file for a function as "extern" and then "export" the function body which is written in separate assembly file . This is what I do in KEIL :
 in the .c file :  extern float sqr_root (float x); 
then in the .s file : 
AREA asm_func, CODE, READONLY
EXPORT sqr_root
;
sqr_root
VSQRT.F32 s0,s0
BX LR

;

;

Any idea on how to do the same on xilinx SDK ????? 
Thx in Advance 

Tags (3)
0 Kudos
2 Replies
Scholar dgisselq
Scholar
1,000 Views
Registered: ‎05-21-2015

Re: Mix C and assembly Code

Why not keep using GCC?

 

On another tack, one of the things I was always taught when adding assembly code to an algorithm was to first build the algorithm in C, and then between the header and footer of the algorithm stuff the asm() statement.  The result might look something like,

 

// in the .c file
float sqr_root(float x) {
#ifndef C_SOLUTION asm(" VSQRT.F32 s0,s0 BX LR");
#else
return sqrt(x);
#endif }

 

Dan

0 Kudos
938 Views
Registered: ‎08-18-2017

Re: Mix C and assembly Code

 @dgisselq I understand this in-line assembly man , but I 'm just trying to use multi-file method , it's more mature for me and have used it all the time , any ideas ? ? 
Sorry for late response :) 

0 Kudos