SDSoC Platform Software Libraries

Every platform IP that exports a AXI4 Stream interface must have hardware functions packaged in a C-callable library that an application can invoke to connect accelerators to the exported interface. You can use the SDSoCsdslibutility to create a static C-callable library for the platform as described inCreating a Library.

  1. The source code for the platform can be found inthe /samples/platforms/zc702_axis_io/srcdirectory.

    The platform AXI4-Stream Data FIFO IP requires a C-callable function to access itsM_AXISport, which in this case will be calledpf_read_stream. The hardware function is defined inpf_read.cpp, as follows. The function declaration is included in the file,zc702_axis_io.h.

    void pf_read_stream(unsigned *rbuf) {}
    The function body is empty; when called from an application, the sdscccompiler fills in the stub function body with the appropriate code to move data. Note that multiple functions can map to a single IP, as long as the function arguments all map onto the IP ports, and do so consistently; for example, two array arguments of different sizes cannot map onto a single AXIS port on the corresponding IP.
  2. For each function in the C-callable interface, you must provide a mapping from the function arguments to the IP ports. The mappings for thepf_read_streamIP is captured inzc702_axis_io.fcnmap.xml.
        

    Each function argument requires name, direction, IP bus interface name, interface type, and data width.

    Important:The fcnMapassociates the platform function pf_read_streamwith the platform bus interface stream_fifo_M_AXISon the platform component zc702_axis_io, which is a reference to a bus interface on an IP within the platform that implements the function. In zc702_axis_io.hpfmthe platform bus interface (“port”) named stream_fifo_M_AXIScontains the mapping to the IP in the xd:instanceRefattribute.
  3. IP customization parameters must be set at compile time in an XML file. In this example, the platform IP has no parameters, so the filezc702_axis_io.params.xmlis particularly simple. To see a more interesting example, open/samples/fir_lib/build/fir_compiler.params.xmlin the SDx install tree.
  4. Thesrc/linuxdirectory contains a makefile to build the library with the following commands.
    sdslib -lib libzc702_axis_io.a \ pf_read_stream pf_read.cpp \ -vlnv xilinx.com:ip:axis_data_fifo:1.1 \ -ip-map zc702_axis_io.fcnmap.xml \ -ip-params zc702_axis_io.params.xml

The library file is stored inzc702_axis_io/sw/aarch32-linux/lib/libzc702_axis_io.a.