Skip to content

Conversation

@Ayushkothari96
Copy link

Fixes #99191

Add conditional compilation to support different STM32 XSPI HAL capabilities across product lines.

Related PRs:

Problem:
After adding XSPI1 compatibility macros (hal_stm32#328), the XSPI PSRAM driver still had STM32H5-incompatible code that assumed all STM32 XSPI peripherals have the same features (XSPI Manager, 16-line data mode, MaxTran/MemorySelect fields).

Solution:

  • Use XSPIM (XSPI Manager) configuration only when xspi_mgr clock exists (STM32H7RS)
  • Use 16-line data mode when HAL_XSPI_DATA_16_LINES is defined (STM32H7RS), otherwise 8-line (STM32H5)
  • Include MaxTran and MemorySelect Init fields only when XSPIM exists

Benefits:

  • STM32H7RS: Uses full hardware capabilities (16-line XSPI with dual-port manager)
  • STM32H5 (H573): Works with simpler single-port XSPI/OCTOSPI implementation (8-line max)
  • Automatic adaptation based on devicetree and HAL feature detection

Testing:

  • Verified compilation on STM32H573I-DK with XSPI PSRAM driver enabled
  • Driver object file successfully created: memc_stm32_xspi_psram.c.obj
  • No code changes needed when switching between STM32 variants

@github-actions
Copy link

Hello @Ayushkothari96, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Add conditional compilation to support different STM32 XSPI HAL
capabilities across product lines:

- Use XSPIM (XSPI Manager) configuration when available (STM32H7RS)
- Use 16-line data mode on STM32H7RS, 8-line on STM32H5
- Include MaxTran and MemorySelect Init fields only when XSPIM exists

This allows the driver to automatically use full hardware
capabilities on STM32H7RS (16-line XSPI with dual-port manager)
while maintaining compatibility with STM32H5 series that have
simpler single-port XSPI/OCTOSPI implementation with 8-line max.

Related to zephyrproject-rtos/hal_stm32#328

Signed-off-by: Ayush Kothari <ayushkot96@gmail.com>
@sonarqubecloud
Copy link

@JarmouniA
Copy link
Contributor

Already addressed by #99194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

STM32 XSPI PSRAM driver does not compile for STM32H573

4 participants