9.1.2. CCS Integration Guide

This page covers the Code Composer Studio (CCS) side of deployment: importing an SDK example, building, flashing and debugging it. What to copy from the run folder, and which SDK example to pick, is described once in Deploying a ModelZoo Run to an SDK Example (Golden-Vector Check).

9.1.2.1. Prerequisites

  • Code Composer Studio 20.4.0 or later (the version used by the 1.5.0 deploy guide), with support for your device family.

  • The device SDK that holds the AI examples (see the SDK table in Deploying a ModelZoo Run to an SDK Example (Golden-Vector Check)), installed through CCS Resource Explorer or standalone.

  • A trained and compiled run (compilation: enable: True). The files you need:

    compilation/artifacts/mod.a
    compilation/artifacts/tvmgen_default.h
    training/quantization/golden_vectors/test_vector.c
    training/quantization/golden_vectors/user_input_config.h
    

    compilation/<date-time>_<model>_<device>.zip bundles the same set.

9.1.2.2. What You Get in the Run Folder

File

Purpose

mod.a

Compiled model library for one device (instruction set and NPU or not). On AM13E2 the project links artifacts/mod_m33_ti_arm_clang.a, so rename the copy.

tvmgen_default.h

Model API (tvmgen_default_run) plus input normalization parameters.

user_input_config.h

#define values that configure the SDK feature-extraction library to match training. SKIP_NORMALIZE and OUTPUT_INT switch model_input_t / model_output_t to int8_t.

test_vector.c

Raw input, expected model input and expected model output for a few samples.

9.1.2.3. Import the Example

  1. Open CCS and go to View -> Resource Explorer.

CCS Resource Explorer

Resource Explorer in Code Composer Studio

  1. Filter by your board (for example LAUNCHXL-F28P55X) and search for the example name.

Resource Explorer with filters

Board and keyword filters

  1. Select the example and click Import; install any dependencies when prompted.

Import project

Importing the example

Download dependencies

Installing required dependencies

The project spec copies artifacts/, test_vector.c, user_input_config.h and application_main.c into your CCS workspace. Edit the workspace copy; the SDK install stays untouched. If an example is not listed in Resource Explorer, use File -> Import Projects and browse to the example’s device folder (see Non-NPU Deployment).

Replace the four files in the workspace project with the ones from your run. Do not change application_main.c, the .syscfg or the linker command file unless you need to (see Memory and Linker Problems).

9.1.2.4. Build, Flash and Run

  1. Project -> Build Project(s) (Ctrl+B) and check the Console for errors.

Build project

Building the project

  1. Set the LaunchPad .ccxml (for example TMS320F28P550SJ9_LaunchPad.ccxml) as the active target configuration: right-click it in Project Explorer.

Active target configuration

Selecting the LaunchPad target configuration

  1. Connect the board over USB and use Run -> Debug Project (or Flash Project). If a firmware-update dialog appears, click Update.

Flash application

Flashing the application

Firmware update dialog

Firmware update dialog

9.1.2.5. Check the Result

  1. In the Debug perspective, add test_result to the Watch window and press Resume (F8).

Debug screen

CCS Debug perspective

Watch test_result

Adding test_result to the Watch window

  1. Read the CIO console. For classification, regression and forecasting:

    Feature extraction mismatches 0
    All tests have passed.
    Golden vectors matched: 2 not matched: 0
    

    test_result is 1 on PASS. Values may differ by at most 1 from the PC result (feature extraction and model output). The “matched” count equals the number of model outputs.

test_result value

test_result after a passing run

For anomaly detection the tolerance on each output is 4, the example then computes the reconstruction error and compares it with RECONSTRUCTION_ERROR_THRESHOLD from user_input_config.h. There test_result means 1 = anomaly, 0 = normal.

To step through the inference yourself, place a breakpoint after the tvmgen_default_run call in application_main.c and inspect model_output.

Breakpoint

Breakpoint after the inference call

9.1.2.6. Memory and Linker Problems

If the linker reports that a section does not fit (for example FFT_buffer_1 or .bss), your model or feature-extraction configuration is larger than the example’s. Start from an example with a similar feature-extraction preset, or adjust the memory placement in lnk.cmd. ModelMaker reports model memory (and, for supported devices, feature-extraction library memory) after compilation; see Device Overview.

9.1.2.7. Common Issues

The full symptom table (FE mismatches, not matched counts, model_input_t build errors, undefined tvmgen_default_run, hang at tvmgen_default_finished) is in the troubleshooting section of Deploying a ModelZoo Run to an SDK Example (Golden-Vector Check). In short: all four files must come from the same run, golden vectors from training/quantization/, and a stale build needs Project -> Clean.

9.1.2.8. Next Steps