Build and Run

Procedure

  1. Build the code.
    1. Switch to the application directory and create a build script CMakeLists.txt. Then, configure the dependency header files and library files necessary for building your code and the name of the generated executable file in the build script.
      Table 1 Mapping between header files and library files

      Header File

      Description

      Library File

      Hiva/cm/open/init.h

      Defines interfaces for initializing and exiting nodes.

      Hiva/cm/libHivaOpen.so

      Hiva/cm/open/node.h

      Defines nodes.

      Hiva/cm/open/publisher.h

      Defines Publisher-related interfaces.

      Hiva/cm/open/subscriber.h

      Defines Subscriber-related interfaces.

      Hiva/cm/open/topic_options.h

      Defines topic options.

      Hiva/cm/open/qos_options.h

      Defines DDS QoS options.

      Hiva/cm/open/service_client.h

      Defines a client.

      Hiva/cm/open/service_server.h

      Defines a server.

      Hiva/cm/open/service_options.h

      Configures service options.

      Hiva/cm/open/buffer_message.h

      Hiva/cm/open/hiva_buffer_pool.h

      Hiva/cm/open/hiva_buffer.h

      Defines the Hivabuffer.

      Hiva/cm/std_msgs/include/xxx.h

      Defines the message types.

      Hiva/cm/console/HIVA_ERROR_code.h

      Defines the error codes.

      Hiva/cm/core/hiva_serializer.h

      Provides Hiva serialization definition, which is used together with the message type.

      Hiva/cm/inner_topic/hiva_nn_topic.h

      Defines the Hiva::CreateNnEngine interface.

      Hiva/cm/libHivaNnengine.so

      Hiva/cm/Hiva_timer/timer.h

      Defines timer-related interfaces, for example, Hiva::CreateTimer.

      Hiva/cm/libHivaTimer.so

      Hiva/cm/Hiva_timer/wall_timer.h

      Defines timer-related interfaces, for example, Hiva::CreateWallTimer.

      Hiva/cm/Hiva_timer/steady_timer.h

      Defines timer-related interfaces, for example, Hiva::CreateSteadyTimer.

      Hiva/cm/Hiva_time/xxx.h

      Defines Hiva time-related types, such as HivaTime and HivaRate.

      Hiva/cm/librostime.so

      Hiva/cm/cfgmgr/param.h

      Defines interfaces related to the CfgMgr subsystem.

      Hiva/cm/libcfgmgr_client.so

      Hiva/cm/securec.h

      Hiva/cm/securectype.h

      Builds and stubs secure functions and removes the dependency on the driver package.

      Hiva/cm/libc_sec.so

      For details about the CMake parameters, go to https://cmake.org/cmake/help/latest/guide/tutorial/index.html and query the required version.

    2. Use the compiler provided by the Ascend product line to run build commands. The following uses the hcc compiler as an example.

      Switch to the directory where the source file (for example, *.cpp) is located and run the cmake command. ($HOME/Ascend is the installation path of Toolkit. Replace it with the actual path.)

      cmake . -DCMAKE_CXX_COMPILER=$HOME/Ascend/toolkit/toolchain/hcc/bin/aarch64-target-linux-gnu-g++

      After the build is successful, an executable file is generated in the directory specified by the build script.

  2. Run the application.

    As the running user, upload the sample directory in the development environment to the running environment. Then, go to the directory where the executable file is located and run the executable file.