Platform Sample Designs

An SDSoC platform can include sample applications that demonstrate its use. The SDx IDE looks for a file called samples/template.xml for information on where the sample application source files reside within the platform. The template file for the zc702_axis_io platform lists several test applications, each of which is of specific interest.
<template location="aximm" name="Unpacketized AXI4-Stream to DDR" 
              description="Shows how to copy unpacketized AXI-Stream data directly to DDR.">
        <supports>
            <and>
                <or>
                    <os name="Linux"/>
                    <os name="Standalone"/>
                </or>
            </and>
        </supports>
        <accelerator name="s2mm_data_copy" location="main.cpp"/>
    </template>
	<template location="stream" name="Packetize an AXI4-Stream" 
                  description="Shows how to packetize an unpacketized AXI4-Stream.">
        <supports>
            <and>
                <or>
                    <os name="Linux"/>
		    <os name="Standalone"/>
                </or>
            </and>
        </supports>
        <accelerator name="packetize" location="packetize.cpp"/>
        <accelerator name="minmax" location="minmax.cpp"/>
    </template>
    <template location="pull_packet" name="Lossless data capture from AXI4-Stream to DDR" 
              description="Illustrates a technique to enable lossless data capture from a free-running input source.">
        <supports>
            <and>
                <or>
                    <os name="Linux"/>
                    <os name="Standalone"/>
                </or>
            </and>
        </supports>
        <accelerator name="PullPacket" location="main.cpp"/>
    </template>

To use a platform in the SDx IDE, you must add it to the platform repository for the Eclipse workspace as described in the following steps.

  1. Launch Xilinx SDx and provide a path to your workspace such as <path_to_tutorial>/myplatforms/.
  2. Create a new project by selecting File > New > Xilinx SDx Project.
  3. Specify a project name in the Create New SDx Project page such as my_zc702_axis_io, and click Next.
  4. In the Choose Hardware Platform page click Add Custom Platform.

  5. Navigate to the folder containing the platform <sdx_root>/samples/platforms/zc702_axis_io.
  6. The platform will show up in the Choose Hardware Platform Page. Select zc702_axis_io (custom) and click Next.

  7. On the Choose Software Platform and Target CPU, keep the default Linux SMP (Zynq 7000) for System Configuration and click Next.
  8. To test the platform with one of the sample applications, in the Templates page, select Unpacketized AXI4-Stream to DDR and click Finish. The s2mm_data_copy function is pre-selected for hardware. The program data flow within s2mm_data_copy_wrapper creates a direct signal path from the platform input to a hardware function called s2mm_data_copy that then pushes the data to memory as a zero_copy datamover. That is, the s2mm_data_copy function acts as a custom DMA. The main program allocates four buffers, invokes s2mm_data_copy_wrapper, and then checks the written buffers to ensure that data values are sequential, i.e., the data is written bubble-free. For simplicity, this program does not reset the counter, so the initial value depends upon how much time elapses between board power-up and invoking the program.
  9. Open up main.cpp. Key points to observe are:
    • The ways in which buffers are allocated using sds_alloc to guarantee physically contiguous allocation required for the zero_copy datamover.
      unsigned *bufs[NUM_BUFFERS];
      bool error = false;
      for(int i=0; i<NUM_BUFFERS; i++) {
           bufs[i] = (unsigned*) sds_alloc(BUF_SIZE * sizeof(unsigned));
      }
      // Flush the platform FIFO of start-up garbage
      s2mm_data_copy_wrapper(bufs[0]);
      for(int i=0; i<NUM_BUFFERS; i++) {
           s2mm_data_copy_wrapper(bufs[i]);
      }
    • The way that the platform functions are invoked to read from platform input.
      void copy_data_wrapper(unsigned int *buf)
      void s2mm_data_copy_wrapper(unsigned *buf) 
      {
          unsigned rbuf0[1];
          pf_read_stream(rbuf0);
          s2mm_data_copy(rbuf0,buf);
      }
  10. Build the application by clicking on the Build icon in the toolbar. When the build completes, the Debug folder contains an sd_card folder with the boot image and application ELF.
  11. After the build finishes, copy the contents of the sd_card directory onto an SD card, boot, and run my_zc702_axis_io.elf.
sh-4.3# cd /mnt
sh-4.3# ./my_zc702_axis_io.elf
TEST PASSED!
sh-4.3#