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 SDSoC sdslib utility to create a static C-callable library for the platform as described in Creating a Library.

  1. The source code for the platform can be found in the <sdx_root>/samples/platforms/zc702_axis_io/src directory.

    The platform AXI4-Stream Data FIFO IP requires a C-callable function to access its M_AXIS port, which in this case will be called pf_read_stream. The hardware function is defined in pf_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 sdscc compiler 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 the pf_read_stream IP is captured in zc702_axis_io.fcnmap.xml.
    <xd:repository xmlns:xd="http://www.xilinx.com/xd">
        <xd:fcnMap xd:fcnName="pf_read_stream" xd:componentRef="zc702_axis_io">
            <xd:arg 
    	    xd:name="rbuf" 
    	    xd:direction="out" 
    	    xd:busInterfaceRef="stream_fifo_M_AXIS" 
    	    xd:portInterfaceType="axis" 
    	    xd:dataWidth="32"
    	/>
       </xd:fcnMap>
    </xd:repository>

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

    Important: The fcnMap associates the platform function pf_read_stream with the platform bus interface stream_fifo_M_AXIS on 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.hpfm the platform bus interface (“port”) named stream_fifo_M_AXIS contains the mapping to the IP in the xd:instanceRef attribute.
  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 file zc702_axis_io.params.xml is particularly simple. To see a more interesting example, open <sdx_root>/samples/fir_lib/build/fir_compiler.params.xml in the SDx install tree.
  4. The src/linux directory 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 in zc702_axis_io/sw/aarch32-linux/lib/libzc702_axis_io.a .