Skip to main content

Generate Code with Builds

Now that you have a component-based system design all wired up, it is time to use Tangram Pro™ to generate a Component Software Interface (CSI) — code that will allow components to pass the messages you specified to other components or systems. I know what you might be thinking... "Generated code is rubbish! It just spits out a template, but you still have to do all the real work." Well, in the case of our generated CSI, it is fully executable and the "real work" is done for you, saving you a ton of time on the tedious code, so that you can work on the code that matters to you. Plus, the output is your choice, C++, Rust or MISRA-C!

You'll learn how to:

  • Configure a Build
  • Select a Message Transport
  • Generate and Download Interface Code

Step 1: Configure a Build

In Tangram Pro™, Builds are a key piece to tightening the linkages between system engineers and software developers to help cross that treacherous gap. Builds are created at the Project level, and persist as part of the system design model even as changes are made. They generate ready-to-run interface code based on the components and connections included in your design.

How to configure a Build

We are going to generate the CSI for the Communications component. If you haven't already, complete the previous tutorial to design your system: Visualize a Project Design.

  1. Click Build in your UAS Project Build
  2. Select the Communications component in the list
  3. Enable Generate Interface Code and select C++ for the Output Language
  4. Enable Compile Code and keep all entered for the Make target options Preflight

Step 2: Run your Build

Generating executable C++ code with a Build is incredibly easy with Tangram Pro™. You'll be provided with source code that can be used as an API to integrate different pieces of software.

  1. Click Build to kick it off
  2. Streaming logs will display as it runs in the cloud and this process may take a few minutes Logs
tip

While it runs you can click Close View of Build Snapshot or even leave the page and it will continue to build in the cloud. Click on Builds within your project to return to it or any previous builds. A notification will pop up when it's completed.

Step 3: Download Code

Download the file linked to the Compile Code task to see the results of the Tangram Pro™ Build. The extracted file will contain a fully generated and built CSI (Component Software Interface).

  1. Wait until your Build completes
  2. Click on the disk icon in the Compile Code task to download the generated and compiled code Download Artifacts
  3. Extract the downloaded file and you'll see a folder named code-gen. This contains all the generated source code Code

Cheers!

By completing this tutorial, you've learned to build a CSI in Tangram Pro™!

Check out what you accomplished:

  • Configured a Build
  • Defined a Message Transport for the project
  • Produce an executable CSI (Component Software Interface)

Our blog is another great place to learn more!

Ready to see you how your CSI in action? Make your way to the next tutorial below!