2. TopsCC Samples

Samples for TopsCC demonstrate features in TopsCC and Runtime.

2.1. Get Started

2.1.1. Prerequisites

Install Runtime library. Install TopsCC.

2.2. Build the Samples with TopsCC

2.2.1. Linux

To build all the samples, type the following command:

make -j8

If the TopsCC is installed in a user-defined path, use TOPS_PATH to specify the path for the build. The default value of TOPS_PATH is /opt/tops.

TOPS_PATH=/opt/tops make -j8

Use TARGET_TOPS_ARCH to specify the target device type:

  • gcu200: for platforms with T20 device

  • gcu210: for platforms with i20 device

  • gcu300: for platforms with 3.0 Hardware

  • general: for platforms with both devices (default)

Example to build sample binaries only for T20 platforms:

TARGET_TOPS_ARCH=gcu200 make -j8

Example to build sample binaries only for i20 platforms:

TARGET_TOPS_ARCH=gcu210 make -j8

Example to build sample binaries only for 3.0 Hardware platforms:

TARGET_TOPS_ARCH=gcu300 make -j8

The binary files will be generated under bin/[device_type] folder, like below:

bin
├── gcu200
│   └── simpleAssert
├── gcu210
│   └── simpleAssert
├── gcu300
│   └── simpleAssert
└── general
    └── simpleAssert

To run the samples, type the following command:

make test

Or run the sample binaries directly to see test result.

NOTE To run RTC related test cases, please export the environment variable CAPS_HOME to specify topscc install location: “export CAPS_HOME=/opt/tops”

NOTE To run the simpleSharedLibrary case, please add ./bin/[device_type]/lib into LD_LIBRARY_PATH, for example:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./bin/general/lib
./bin/general/simpleSharedLibrary