R2021a introduced native plugins for Jenkins Pipeline and GitLab CI/CD. A typical pipeline can now:
Example Jenkinsfile snippet:
stage('Polyspace Code Prover')
steps
polyspaceCodeProver(
sources: 'src/',
targetCompiler: 'gnu9',
misraRules: 'misra_c_2012',
resultsDir: 'polyspace_results'
)
Polyspace R2021a (version 2021a) focuses on enhanced MISRA compliance, C++11/14 support improvements, and streamlined reporting.
Polyspace R2021a (part of MathWorks’ Polyspace family) is a static code analysis toolset aimed at identifying bugs, run-time errors, and coding standard violations in C, C++, and Ada code without executing the program. It’s commonly used in industries with high safety, security, or regulatory requirements (automotive, aerospace, medical devices, industrial controls) to find defects early, reduce testing load, and provide evidence for certification.
Before dissecting the R2021a update, it is crucial to understand the two core products within the Polyspace family:
R2021a brought these two tools closer together, offering a unified desktop interface and significantly improved server-side processing.
For full release notes, consult $MATLABROOT/help/polyspace/release-notes.html in R2021a installation.
Polyspace R2021a is a major update to the MathWorks static code analysis suite, designed to help developers prove the absence of critical run-time errors and uncover defects early in C and C++ projects. This release focuses on performance optimizations for large-scale embedded systems, particularly those using the AUTOSAR standard, and introduces new tools to manage code complexity. Key Advancements in Polyspace R2021a polyspace r2021a
The R2021a update delivers refinements across the entire Polyspace product line, from local IDE plugins to centralized web-based reporting.
Enhanced AUTOSAR Support: Polyspace Code Prover™ now runs faster and provides more precise results for code using the AUTOSAR RTE API. A new -library option allows for "smart stubs" that target AUTOSAR-specific checks without the overhead of checking the entire library implementation.
Mixed C/C++ Projects: Developers can now run a single Polyspace Code Prover analysis on projects containing a mix of C and C++ source files, simplifying the verification of modern multi-language codebases.
New Guidelines Checkers: A new category of customizable checkers in Polyspace Bug Finder™ helps teams monitor software complexity. These checkers track metrics like cyclomatic complexity and the number of paths to identify "heavy" modules that require refactoring before they become maintenance burdens.
Cross-Release Workflow: With R2021a, users can analyze code generated in earlier releases of Simulink® (R2020b or later) using the new pslinkrunCrossRelease function, allowing teams to upgrade their analysis tools without needing to migrate their entire model-based design environment immediately. Collaborative Analysis with Polyspace Access
For team-based development, Polyspace Access™ introduces several UI and workflow improvements in R2021a to streamline result triage.
Custom Filters: Users can define and share custom filter groups, allowing organizations to focus on the specific findings most relevant to their internal safety or security standards. R2021a introduced native plugins for Jenkins Pipeline and
Results Comparison: The web interface now includes a filter to view findings from a baseline run that have been fixed in the current run, providing clear evidence of progress during remediation.
Optimized Code Review Layouts: A new default Code Review layout prioritizes the source code view, making it easier for developers to investigate the root cause of issues directly in the browser. Expanded Language and Compiler Support
To support modern development environments, R2021a expands its compatibility with industry tools:
Compilers: Added support for Visual Studio 2019 and GCC 8.x.
Standards Compliance: Expanded coverage for AUTOSAR C++14, CERT C++, and MISRA C++ rules.
PQL (Polyspace Query Language): Users can now create their own custom defect checkers and coding standards using PQL, which supports a new .pql file format and a dedicated command-line tool. The "Shift Left" Philosophy Polyspace Notes - MATLAB & Simulink - MathWorks
The Polyspace R2021a release from MathWorks introduced significant advancements in handling complex C/C++ projects, particularly for safety-critical and automotive industries. This version focused on speed, mixed-language support, and expanded compliance for international safety standards. Key Features & Major Updates Polyspace R2021a (version 2021a) focuses on enhanced MISRA
Mixed C/C++ Analysis: Polyspace Code Prover now supports projects containing both C and C++ source files simultaneously. By using the -lang C-CPP option, the tool compiles and verifies them as a unified C++ project, eliminating the need to separate files.
AUTOSAR Enhancements: Analysis of code using the AUTOSAR RTE API is faster and more precise. New "smart stubs" for AUTOSAR libraries allow users to check for standard compliance without losing precision or needing complex manual setups.
New "Guidelines" Checkers: Polyspace Bug Finder introduced a new category for software complexity. These customizable checkers measure metrics like cyclomatic complexity and the number of execution paths, helping developers identify and refactor overly complex modules early.
Expanded Coding Standards: Support was added for additional rules within AUTOSAR C++14, CERT C++, and MISRA C++.
Cross-Release Workflows: Users can now use Polyspace R2021a to analyze code generated in previous versions of Simulink (starting from R2020b) using the pslinkrunCrossRelease function. Usability and Integration
Compiler Support: Added official support for Visual Studio 2019 and GCC 8.x compilers.
Simplified Setup: The integration process between Polyspace and MATLAB/Simulink was streamlined to require fewer steps.
Polyspace Access Improvements: Features enhanced logging for services within the Admin UI, aiding team collaboration and project tracking. Core Tool Comparison Polyspace R2021a continues to rely on two primary engines: What's New in Polyspace R2021a? - MATLAB & Simulink
A static analysis tool is only as good as its precision. A tool that cries wolf (false positives) eventually gets ignored by developers. Polyspace R2021a introduces updated abstract interpretation algorithms that improve precision in complex control flow scenarios.