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!

Showing results for 
Search instead for 
Did you mean: 
Registered: ‎03-27-2019

Using RFDC driver in C++ application

I would like to develop a C++ app and use the RFDC driver which is a .so library compiled in c. Could you please show me the right way to accomplish this in the SDK?

This is what I have done so far:

1. follow the guide Linux App RFDC in xilinx wiki, I have the driver working with a simple C program.

2. Instead of C app, I created a new simple C++ linux app, with the right sysroot path and libraries: metal, m, rfdc like I have in C.

3. Made sure that the xdfc.h and the rest of the RFDC .h files have the extern __cpluplus symbol defined and eclipse has it by default.

4. I tried using language mapping following some tips found  here in xilinx forums.

5. I tried not using the .so library but importing all the RFDC files into the project but doing this it gets me a lot of errors (as expected). I thought that I can fix them for the RDFC driver but now I am getting errors from metal/io.h so bad luck as this seems a never ending task. I think there should be somthing I can do in SDK eclipse, apart from the language mapping, to make it work in C++ without fixing C-C++ errors.

6. The application returns failed after calling XRFdc_DynamicPLLConfig.

Thanks for helping.


0 Kudos
1 Reply
Registered: ‎03-27-2019

Re: Using RFDC driver in C++ application

I finally managed to make it work.

My final goal was using C-compiled code (RFDC drivers for the ZCU111 board) and add the functionality like c++ vectors along with some other c++ cool stuff like boost  libraries.

First of all, because I am using RFDC drivers compiled in C, I decided to use C in XSDK and invoking C++ .hpp and cpp code within my main program like “cpp_header.hpp”. This header is language mapped with C++ in source file properties, like it is explained in this forum.  However, because I am using C language I had  to do few things:

  1. For the header .hpp, wrap my c++ functions prototypes in #ifdef extern C { etc., etc. I did not use any C++ libraries here.
  2. In the .cpp file I add the c++ libraries and define my c++ functions.
  3. Define in path and symbols file properties the symbol __cplusplus with any value, it can be 1.
  4. You need to set your toolchain in toolchain editor for the cpp file using ARM V8 linux g++ compiler. First, I tried gcc compiler but it gave me linker errors, in stackoverflow they suggested use the g++ as it has more functionality when linking libraries automatically so also…
  5. In the PROJECT properties, not the file, go to settings linker command, and change gcc for g++.

Hopefully, this will help you to use in XSDK the ability to wrap c++ code using C compiler for the whole project and for those c++ files the g++ compiler.

0 Kudos