API manual

This chapter explains how to use the command-line tool integrated with STM32CubeIDE for Visual Studio Code.

Overview of command line

The command-line tool provides a convenient way to access help information for its commands. This enables users to understand the available commands and their usage without referring to external documentation.

Usage

To display help information for a specific command, use the following syntax:

cube <command> --help

Here:

  • cube is the main command-line tool executable.

  • <command> is the specific command for which you want help.

  • --help is the option that displays usage information for the given command.

To list all installed bundles, use the following syntax:

cube --list

Here:

  • cube is the main command-line tool executable

  • --list is the command that displays all installed bundles.

Example:

To get help on the pack command, run:

cube pack --help

This command displays information such as:

  • Description of the pack command.

  • Available options and flags.

  • Usage examples.

  • Any additional notes or requirements.

Install a specific bundle version

To install a specific version of a bundle, use the following syntax:

cube bundle install example-bundle@X.Y.Z

Here:

  • cube is the main command line tool executable.

  • bundle specifies the bundle management command.

  • install triggers the installation process for the specified bundle.

  • example-bundle@X.Y.Z is the bundle name followed by the exact version number. Replace example-bundle with the desired bundle name and X.Y.Z with the version number.

Additional documentation

Some installed bundles provide additional documentation through the Documentation field.

Example:

To get detailed information about an installed bundle, run:

cube --json bundle show <bundle>

This command displays a detailed view of the installed bundle. Some bundles include a Documentation field with a link to the readme file.

DevOps corner

For more advanced use cases, you can automate workflows using cube commands.

Quick start

Setting up and sharing projects with the cube command-line tool involves initializing the project with required bundles and installing them consistently across developer and CI environments. Use:

  • cube bundle init --project [bundles] to initialize the project.

  • cube bundle install --project <bundles> for local development.

  • cube bundle install --project for CI automation.

This workflow streamlines project management, testing, and deployment.

Developer workflow

This chapter explains how to set up a project using the cube command-line tool and how to share it efficiently for testing and automation. The process involves initializing the project with required bundles and installing those bundles both locally and in Continuous Integration (CI) environments.

Initialize a project with bundles

To create a new project and specify the bundles it depends on, use the following command:

cube bundle init --project [bundles]
  • --project specifies the project context.

  • [bundles] is a space-separated list of bundle names to include in your project.

This command initializes the project configuration and records the bundles to be used, setting up the environment for development.

Install bundles for the project

After initializing the project, install the specified bundles locally using:

cube bundle install --project <bundles>
  • This command installs the bundles listed for the project, ensuring your development environment has all necessary components.

  • You can specify bundles explicitly or rely on the project configuration to install all required bundles.

CI workflow

In Continuous Integration (CI) environments, install project bundles automatically to enable testing and automation workflows. Use the following command:

cube bundle install --project
  • Running this command in CI installs all bundles defined in the project configuration.

  • This ensures consistency between developer environments and automated pipelines.

  • There is no need to specify bundles explicitly; the project configuration drives the installation.

Benefits of this approach

  • Consistency: Developers and CI environments use the same bundle definitions, reducing compatibility issues.

  • Automation: Simplifies automated testing and deployment pipelines.

  • Scalability: Add or remove bundles from the project configuration without changing CI scripts.

  • Collaboration: Sharing the project setup via configuration files allows teams to synchronize dependencies easily.