Sample Applications
Optionally, a platform can include sample applications to demonstrate the usage of the platform. Sample applications can be provided in the samples directory of a platform. Each sample application is located in a sub-directory of the samples directory, as illustrated in Directory Structure for a Typical SDSoC Platform, and is described by a description.json file.
The following is an example description.json for the array_copy sample application in the Arty platform found in the <SDX_Install_Dir>/samples/platforms/arty/samples/arty_arraycopy folder.
{
"example": "Arraycopy",
"overview": "Implementation of an array copy core that simply reads from one array and
writes to another. By default the function arraycopy() is marked for hardware and you
can build the project."
"board": [ "arty" ],
"os": [ "Standalone" ],
"runtime": [ "C/C++" ],
"accelerators": [
{
"name": "arraycopy",
"location": "arraycopy.cpp"
}
],
"contributors" : [
{
"group" : "Xilinx, Inc.",
"url" : "http://www.xilinx.com"
}
],
"revision" : [
{
"date" : "2018",
"version" : "1.0",
"description" : "Initial revision"
}
]
}
- Name and description: The example (name) is required, but the overview (description) is recommended.
- Platform: The board is optional, but the OS and runtime are required.
- Accelerators: Required to specify the hardware function name and the location of the source code file.
- Contributors: Optionally identifies the name and description of the source code provider.
- Revision: Optionally specifies version information.
The following table shows a complete list of the available attributes.
Attribute | Description |
---|---|
"example" | Name displayed in the GUI. |
"overview" | Description displayed in the GUI. |
"type" | Used to identify library projects vs application projects. |
"board" | List of supported platforms; if specified, project platform must match an entry in the list. |
"os" | List of supported operating systems. |
"runtime" | List of supported runtime environments. |
"accelerators" | List of hardware function names and source files. |
"exclude" | List of files and directories that should not be copied into the example project. |
"compiler" | Settings to specify compiler options and include directories. |
"linker" | Settings to specify linker options, library paths, and libraries. |
"system" | System-level settings. |
"cmd_args" | Command line arguments used when launching the GUI. |
"revision" | A list of revisions. |
"contributors" | A list of contributors/authors for the example. |
Example
"example"
attribute defines the name of
the sample application to show in the SDx™ GUI. It should be
descriptive, but not overly
long."example" : "Array Copy"
Overview
"overview"
attribute is a longer text
description of the sample application. The value can be either a single string, or
an array of strings. - Single string:
"overview" : "Shows a __median filter__ function accelerated in hardware."
- Array of strings:
"overview" : [ "This is the first line of the description.", "The description supports limited Markdown syntax,", "including __bold__, _italics_, and ~~strikethrough~~.", "- list item 1", "- list item 2", ]
Type
"type" : "library"
Board
board
attribute lists all development board platforms
this example is compatible with. If omitted, this example is available for any
platform. The sample application will be available if the current platform matches
any of the values in the list. If the example is included with a custom platform,
the example is available for the custom platform only, and board
need not be specified.
"board" : [
"zc702",
"zc706"
]
Operating System (OS)
The os
attribute defines an operating
system match for the selected SDSoC™ platform. The OS
value is a list of supported operating systems
including Linux, Standalone, and FreeRTOS. The sample application will be available
if the current operating system matches any of the values in the list.
"os" : [
"Linux",
"Standalone",
"FreeRTOS"
]
Runtime
The runtime
attribute defines the runtime
environments supported by this example is C/C++. The sample application will be
available if the run time of the project matches any of the values in the list. For
example, an example might work for the OpenCL runtime, and not work for the C/C++
runtime.
C/C++
:
"runtime" : [
"C/C++"
]
Accelerators
Accelerators
attribute is a list of hardware
functions that will be set up when creating a new project. The
Accelerators
attribute includes several required and optional
sub-tags: name
: A required value that specifies the name of the function.location
A required value that specifies the path to the source file containing the function. The path is relative to the sample application folder in the platform.clkid
: An optional values that specifies the accelerator clock to use instead of the default.hlsfiles
: A optional value that specifies a list of additional files to compile along with the source file, when the accelerator calls code found in other files. The SDSoC environment invokes Vivado® HLS to compile the source file containing the function. If the source file depends on functions contained in additional source files, usehlsfile
to specify those source files.
"accelerators" : [
{
"name" : "func1",
"location" : "func1.cpp"
},
{
"name" : "func2",
"location" : "func2.cpp",
"clkid” : "2",
"hlsfiles" : [
"func2_helper_a.cpp",
"func2_helper_b.cpp"
]
}
]
Compiler
compiler
attribute is optional, and is used to specify
the following compiler options: includepaths
: Defines a set of paths relative to the sample application folder that are passed to thesds++
compiler using the-I
flags.options
: Defines application project settings for the compiler when creating a new project. The value defines compiler options required to build the application and appears in the SDx environment C/C++ Build Settings dialog box as compiler Inferred Options under the software platform.symbols
: Defines a list of pre-processor symbols. This is an alternative tooptions
when you want the symbols to show in the symbols list in the Eclipse project build settings.
-I"../src/myinclude"
-I"../src/dir/include"
, and the compiler option -D MYAPPMACRO
, to the compiler
command:
"compiler" : {
"includepaths” : [
"myinclude",
"dir/include"
]
"options" : "-D MYAPPMACRO"
}
Linker
linker
attribute is optional, and is used to add
directories to the link path, and add libraries to be linked. When using multiple
linker settings, they should be added to the same linker
node.librarypaths
: Specifies a list of paths relative to the application build directory (which is the location of the compiled application). The specified paths are passed to the linker using-L
flags.libraries
: Secifies additional libraries that are to be passed to the linker-l
flags.options
: Defines application project settings for the linker when creating a new project. The value defines linker options required to build the application and shows in the SDx environment C/C++ Build Settings dialog box as linker Miscellaneous options.For SDSoC projects, use the
sdcard
attribute c to specify thesds++ -sdcard <path>
option. The SD card path is relative to the build directory:
-lmylib1
-lmylib2
, and -L"mylibrary"
, and add
the linker option -poll-mode 1
to the linker
command line, and specifies the -sdcard
path:"linker": {
"options" : "-poll-mode 1",
"libraries" : [
"mylib1"
"mylib2"
],
"librarypaths" : [
"mylibrary"
]
"sdcard" : "../sdcard"
}
Exclude
The exclude
attribute defines a set of directories and files
to be excluded from being copied when SDx creates the new
project. This lets you have files or directories in the sample application folder
that are not used to build the application.
"exclude" : [
"MyDir",
"MyOtherDir",
"MyFile.txt",
"MyOtherFile.txt"
]
System
The optional system
attribute defines application project
settings for the system when creating a new project. The dmclkid
attribute defines the data motion clock ID. If the system
attribute
is not specified, the data motion clock uses the default clock ID.
"system" : {
"dmclkid" : “2”
}
cmd_args
cmd_args
attribute defines a custom command
line when launching the SDSoC application. There are two special
variables that can be used in the cmd_args
: PROJECT
is replaced with the path to the project directory.BUILD
is replaced with the path to the build directory.
These variables can be used to specify project-rooted data files, or build-output files.
Revision
revision
attribute provides the revision of the
sample application, and with some limited revision history. The attribute includes
several optional sub-tags:date
: A user-meaningful string representing a date for the sample application.version
: A string representing the version of the application as a period-delimited string of numbers, typicallymajor.minor[.update]
. For example: 1.0, or 2.5.1. If a sample application lists multiple versions, the highest number is considered the most recent version.description
: Astring providing a brief description of the revision.
"revision" : [
{
"date" : "2017",
"version" : "1.2",
"description" : "Updated the example for the 17.1 release"
},
{
"date" : "2018",
"version" : "1.0",
"description" : "original release"
}
]
Contributors
contributors
attribute is a list of contributors to the
example, including the following sub-tags:group
: A string specifying the name of the sample application developer.url
: Specifies a URL for the contributor.
"contributors" : [
{
"group" : "Xilinx, Inc.",
"url" : "http://www.xilinx.com/"
}
]