STM32CubeIDE for Visual Studio Code Documentation

Table Of Contents

- STM32CubeIDE for Visual Studio Code
- Introduction
  - Overview
  - System requirements
  - Release note
- Basic Concepts
  - User interface
  - Command-line tools
  - Visual Studio Code extension packs
  - Bundles
  - CMake
  - Toolchains
  - STMicroelectronics Arm Clang Toolchain for STM32
- Getting Started
  - Installation
  - First project creation
- Workspace and extension workflow
  - Workspace overview
  - Extension commands
  - Project files
  - Multi-project workspaces
- Tutorials
  - Migrating from STM32CubeIDE for Visual Studio Code extension 2.x to 3.x
  - Dual-core STM32 projects
  - Power management
  - RTOS-based STM32 projects
  - Firmware security and integrity
- Development
  - Projects
  - Editing
  - Build
  - Debug
  - API manual
  - Integration with external tools
  - Testing and validation
- Troubleshooting
  - Frequently asked questions
  - Known issues
  - Support

### On this page

- Threat model and scope
- Secure build and artifact controls
- Integrity verification patterns
- Anti-rollback version policy
- Debug access in production
- Key and secret handling basics
- Security validation checklist
- Incident response readiness
- Recommended project practices

# Firmware security and integrity

Security and integrity controls are required for reliable firmware lifecycle management. This chapter describes practical controls for STM32 projects using STM32CubeIDE for Visual Studio Code.

This chapter focuses on:

- Protecting release artifacts from unauthorized modification

- Verifying firmware identity before activation

- Reducing rollback and debug-access risks in production

- Defining validation evidence for release approval

## Threat model and scope

Define a security scope before implementation. Security controls must match the product deployment model and threat surface.

Typical threat classes are:

- Unauthorized firmware replacement

- Downgrade to a vulnerable firmware version

- Extraction of sensitive data through debug interfaces

- Tampering during transfer or storage

Document assumptions explicitly:

- Physical access level to the target hardware

- Network exposure of update transport

- Required regulatory and product constraints

Note

This chapter defines implementation patterns, not product certification claims.

## Secure build and artifact controls

Security starts in the build pipeline. A trusted update process is not possible with untrusted artifacts.

Use these controls in STM32CubeIDE for Visual Studio Code workflows:

1. Build release artifacts from a tagged source revision.

2. Record artifact hashes for `.elf`, `.hex`, and `.bin` outputs.

3. Keep build and programming tasks under version control in `.vscode/tasks.json`.

4. Record bundle and toolchain baseline used for the release build.

For artifact and task context, see Build and API manual.

## Integrity verification patterns

An update image must be verified before activation.

Common verification layers are:

- Transport integrity check

- Image hash verification

- Signature verification when the product architecture supports it

Minimum activation policy:

1. Validate image format and size constraints.

2. Validate image integrity metadata.

3. Reject activation on any verification failure.

4. Keep previous confirmed image available when product architecture allows it.

Store verification result codes in logs that are accessible during support and failure analysis.

## Anti-rollback version policy

Define a firmware version policy that blocks vulnerable downgrades.

Policy elements:

- Monotonic version identifier

- Explicit compatibility rules between bootloader and application

- Allowed downgrade exceptions for service operations

Implementation guidance:

1. Compare incoming version against stored minimum accepted version.

2. Reject unauthorized downgrade attempts.

3. Record downgrade rejection events for diagnostics.

Caution

Downgrade policy must be tested with real recovery scenarios before production rollout.

## Debug access in production

Debug access policy is part of the security model.

For production targets:

- Define when debug access is disabled, restricted, or service-controlled.

- Separate development and production debug configurations in `launch.json`.

- Require explicit service procedure for any temporary debug enablement.

For development targets:

- Keep full debug visibility for root-cause analysis.

- Avoid reusing development debug settings in production images.

For debug workflow details, see Debug.

## Key and secret handling basics

If the product uses cryptographic verification, key handling must be controlled throughout the lifecycle.

Baseline practices:

- Keep private signing keys outside source repositories.

- Use environment or secure-service injection for signing operations.

- Restrict signing permissions to approved release roles.

- Rotate keys based on product policy and incident response requirements.

Do not store long-term secrets in project files, task files, or launch configurations.

## Security validation checklist

Before release approval, verify at least the following on target hardware:

1. Artifact hash matches release manifest.

2. Invalid image is rejected before activation.

3. Version rollback policy behaves as specified.

4. Production debug access policy is enforced.

5. Recovery path works after interrupted update simulation.

Release evidence should include:

- Build and hash logs

- Verification and activation logs

- Security test verdict summary

## Incident response readiness

Prepare response procedures before field deployment.

Response plan should define:

- How to identify affected firmware versions

- How to block vulnerable update paths

- How to deploy corrected firmware safely

- How to collect diagnostics without expanding exposure

Maintain a tested rollback or recovery path for emergency updates.

## Recommended project practices

To keep security controls stable across product iterations:

- Review threat model at each major release

- Keep security requirements in product-level specifications

- Validate secure update behavior in continuous integration gates

- Re-run security regression tests after toolchain or bundle upgrades