TIOVX User Guide
Adding New Targets to TIOVX

Explanation of Targets in TIOVX

A good place to start in understanding the concept of a "target" in TIOVX is to compare and contrast it with the concepts of "CPU" and "core" on a TI SoC. TI's SoC's have a number of heterogenous cores, such as ARM's, DSP's and HWA's. However, only the cores that run an operating system, such as FREERTOS, are considered CPU's. When comparing these concepts to the definition of a "target" in TIOVX, a target is simply a thread running on a given CPU.

TIOVX provides one or more target threads for each of the given CPU's. Additionally, for each of the HWA's, TIOVX has a thread running on the R5F (MCU2_0) to call into the VPAC HWA's. In the graph based model of TIOVX, a given node is assigned to a target thread. When the graph is processed, if multiple nodes are assigned to the same target, each node processing call will run to completion on the given target before the next node on that target becomes available. Additionally, in the case of HWA targets, a target becomes unblocked once the R5F initiates the processing on the HWA because it is pending on the completion of processing on the HWA. For additional details, please refer to Target Execution Model

For a list of default targets that TI provides as part of TIOVX for this SDK, refer to a: TI Targets

Code Changes to Enable More Targets

In certain situations, multiple target threads may need to be added to a given CPU beyond the single target provided by TIOVX. (For exapmle, in the case of pipelining applications and two algorithms must run in parallel on the same core.) In this case, the framework requires a set of changes to enable the new target. These changes are described in the steps below.

Step 1

File to change: include/TI/tivx.h

Required Changes: A new #define needs to be added for the new target name. The #define follows the pattern of TIVX_TARGET_<New target name>. The #define should be a unique string identifier.

Step 2

File to change: source/platform/psdk_j7/common/soc/tivx_platform_psdk_<soc>.h

Required Changes: The TIVX_PLATFORM_MAX_TARGETS must be increased by the number of new targets added.

Step 3

File to change: source/platform/psdk_j7/common/soc/tivx_platform_psdk_<soc>.h

Required Changes: The new enumeration value for the new target must be added to the tivx_target_id_e enumeration in the format TIVX_TARGET_ID_<New target name>. This must be set equal to TIVX_MAKE_TARGET_ID with the first argument being the CPU ID that this new target is to be run on and the second argument being the 1 plus the existing number of threads on that target.

Step 4

File to change: source/platform/psdk_j7/common/soc/tivx_platform_psdk_<soc>.h

Required Changes: The #define from Step 1 and the enumeration from Step 3 must be added to the TIVX_TARGET_INFO structure. For example, the DSP1 target is added to this structure with the line {TIVX_TARGET_DSP1, (vx_enum)TIVX_TARGET_ID_DSP1}.

Step 5

File to change: Dependent on chosen CPU. Available options:

  • MPU Targets: source/platform/psdk_j7/common/tivx_target_config_mpu1_0.c
  • R5F Targets: source/platform/psdk_j7/rtos/<soc>/tivx_target_config_r5f_<soc>.c
  • C66X Targets: source/platform/psdk_j7/rtos/tivx_target_config_c66.c
  • C7X Targets: source/platform/psdk_j7/rtos/tivx_target_config_c7.c

Required Changes: The target thread must created in the appropriate file depending on the CPU that this new thread must be run on. The API to create the new thread is tivxPlatformCreateTargetId(). Each of these files are slightly different in the way that they call this API. Regardless of the file, the tivxPlatformCreateTargetId() must be called with the first argument being the target ID enumeration created in Step 3. The second parameter will be dependent on the desired parameters of the developer.

Step 6

File to change: source/platform/pc/common/tivx_platform_pc.h

Optional Changes: In the case that PC emulation mode is needed, the #define from Step 1 and the TIVX_TARGET_ID_CPU1 enumeration must be added to the TIVX_TARGET_INFO structure in a similar way as Step 4. For example, the DSP1 target is added to this structure with the line { TIVX_TARGET_DSP1, TIVX_TARGET_ID_CPU1 }.

Disclaimer about "priority" argument for TIOVX targets

One of the parameters to the tivxPlatformCreateTargetId API is "priority". The value of the priority set for this argument is based on the OS priorities of which the core is running. Therefore, when adding a new target to a given core, the developer should be aware of which OS is being used on that core. This is of particular interest because the priority ordering is different in Linux vs in QNX/FreeRTOS/SafeRTOS. A few references for this information can be found for Linux, QNX, and FreeRTOS.

TIOVX supports Linux/QNX on the A72 and FreeRTOS/SafeRTOS on the R5F/C66/C7X and thus the priorities set for the tasks running on each of these cores is taken into account and optimized for the use cases of interest for the TIOVX framework. For instance, the capture target is running at the highest priority level for the R5F OS in order to prioritze the receiving of capture frames within a given system.