Creating and Using C-Callable IP Libraries

Using a C-callable IP library is similar to using any software library, but instead of running all library functions on the target CPU, the sds++ linker calls into hardware functions for some of the library entry points. One advantage of a C-callable IP library is that the underlying IP could be custom-designed using a hardware description language (HDL), either because the IP already exists, or to achieve a specific hardware microarchitecture that is most easily achieved using an HDL.

Another advantage of a C-callable IP library is that the underlying IP might be complex, with multiple functions that map onto to it through a userspace driver. By calling into these functions, an application can employ sds++ to create the hardware system connectivity to the IP.

An application includes header files for the library and the sds++ -I<path> option to compile and link. For example:

sds++ -sds-pf zc702
–c –I<path to header> –o main.o main.c

When you are using the SDSoC IDE, you add these sds++ options by right-clicking on your project, selecting C/C++ Build Settings > SDS++ Compiler > Directories (or SDS++ Compiler > Directories for C++ compilation).

To link the library into your application, you use the -L<path> and -l<lib> options.
sds++ –sds-pf zc702 ${OBJECTS} –L<path to library> -l<library_name> –o myApp.elf
TIP: As with the standard GNU linkers, for a library called libMyLib.a, you use -lMyLib.

When you are using the SDSoC IDE, you add these sdscc options by right-clicking on your project, selecting C/C++ Build Settings > SDS++ Linker > Libraries.

You can find code examples that employ C-callable libraries in the SDSoC™ environment installation under the samples/fir_lib/ and samples/rtl/ directories.