HAL1 automatic detection script

STM32Cube HAL2 provides an advanced tool to streamline the migration from HAL1 to HAL2. The HAL1 automatic detection script is designed to support this transition by:

  • Analyzing existing applications and detecting all HAL1 API calls

  • Highlighting APIs that require updates or replacements

  • Generating comprehensive reports to guide users step-by-step through the migration to HAL2 APIs

  • Optionally stubbing detected HAL1 code regions to isolate migration work inside the user application

  • Providing both human-readable HTML reports and machine-readable JSON output for automation flows

  • Offering an interactive HTML migration workspace with filtering, progress tracking, and editable per-file source drafts

The launcher ( hal1_detection.py or hal1_detection.exe) uses a side-by-side script package named hal_detection_stubbing_script by default. This package name can be overridden through the StubScriptModuleName configuration entry or through the HAL_STUB_SCRIPT_MODULE_NAME environment variable. This mechanism allows the migration logic to be updated next to the launcher without rebuilding the executable package.

Note

The STM32Cube HAL1-to-HAL2 migration tool is provided as a standalone HAL2_Migrator ZIP package available for download from st.com

This section introduces:

  • The migration script concept: its scope and benefits.

  • Script setup and configuration: practical instructions.

  • Script features: examples that illustrate its capabilities.

script scope

An overview of the migration script, including its scope and boundaries.

Script scope
script environment setup

Hands-on migration script setup and configuration.

Script setup and usage
script features

Script features and capabilities.

Script stubbing features