Skip to content

STM32 XSPI PSRAM driver does not compile for STM32H573 #99191

@tpambor

Description

@tpambor

Describe the bug

Enabling the STM32 XSPI PSRAM driver when compiling for a board with STM32H573 results in compilation failures.

Regression

  • This is a regression.

Steps to reproduce

Build e.g. hello_world sample with

prj.conf

CONFIG_MEMC=y

Devicetree overlay:

&xspi1 {
	memc: aps256xxn-obr@0 {
		compatible = "st,stm32-xspi-psram";
		reg = <0>;
		size = <DT_SIZE_M(256)>; /* 256 Mbits */
		max-frequency = <DT_FREQ_M(200)>;
		fixed-latency;
		read-latency = <4>;
		write-latency = <1>;
		burst-length = <0>;
		st,csbound = <11>;
		status = "okay";
	};
};

Relevant log output

/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c: In function 'memc_stm32_xspi_psram_init':
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:302:17: error: unknown type name 'XSPIM_CfgTypeDef'; did you mean 'USB_CfgTypeDef'?
  302 |                 XSPIM_CfgTypeDef cfg = {0};
      |                 ^~~~~~~~~~~~~~~~
      |                 USB_CfgTypeDef
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:304:40: error: 'XSPI1' undeclared (first use in this function); did you mean 'SPI1'?
  304 |                 if (hxspi->Instance == XSPI1) {
      |                                        ^~~~~
      |                                        SPI1
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:304:40: note: each undeclared identifier is reported only once for each function it appears in
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:305:28: error: request for member 'IOPort' in something not a structure or union
  305 |                         cfg.IOPort = HAL_XSPIM_IOPORT_1;
      |                            ^
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:305:38: error: 'HAL_XSPIM_IOPORT_1' undeclared (first use in this function)
  305 |                         cfg.IOPort = HAL_XSPIM_IOPORT_1;
      |                                      ^~~~~~~~~~~~~~~~~~
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:306:47: error: 'XSPI2' undeclared (first use in this function); did you mean 'SPI2'?
  306 |                 } else if (hxspi->Instance == XSPI2) {
      |                                               ^~~~~
      |                                               SPI2
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:307:28: error: request for member 'IOPort' in something not a structure or union
  307 |                         cfg.IOPort = HAL_XSPIM_IOPORT_2;
      |                            ^
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:307:38: error: 'HAL_XSPIM_IOPORT_2' undeclared (first use in this function)
  307 |                         cfg.IOPort = HAL_XSPIM_IOPORT_2;
      |                                      ^~~~~~~~~~~~~~~~~~
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:309:20: error: request for member 'nCSOverride' in something not a structure or union
  309 |                 cfg.nCSOverride = HAL_XSPI_CSSEL_OVR_DISABLED;
      |                    ^
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:309:35: error: 'HAL_XSPI_CSSEL_OVR_DISABLED' undeclared (first use in this function); did you mean 'HAL_XSPI_DATA_DTR_DISABLE'?
  309 |                 cfg.nCSOverride = HAL_XSPI_CSSEL_OVR_DISABLED;
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   HAL_XSPI_DATA_DTR_DISABLE
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:311:21: warning: implicit declaration of function 'HAL_XSPIM_Config'; did you mean 'HAL_XSPI_Init'? [-Wimplicit-function-declaration]
  311 |                 if (HAL_XSPIM_Config(hxspi, &cfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
      |                     ^~~~~~~~~~~~~~~~
      |                     HAL_XSPI_Init
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:337:55: error: 'HAL_XSPI_DATA_16_LINES' undeclared (first use in this function); did you mean 'HAL_XSPI_DATA_4_LINES'?
  337 |         cmd.DataMode = DT_INST_PROP(0, io_x16_mode) ? HAL_XSPI_DATA_16_LINES
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~
      |                                                       HAL_XSPI_DATA_4_LINES
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c: At top level:
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:418:26: error: 'XSPI_InitTypeDef' has no member named 'MaxTran'
  418 |                         .MaxTran = 0U,
      |                          ^~~~~~~
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:420:26: error: 'XSPI_InitTypeDef' has no member named 'MemorySelect'; did you mean 'MemorySize'?
  420 |                         .MemorySelect = HAL_XSPI_CSSEL_NCS1,
      |                          ^~~~~~~~~~~~
      |                          MemorySize
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:420:41: error: 'HAL_XSPI_CSSEL_NCS1' undeclared here (not in a function)
  420 |                         .MemorySelect = HAL_XSPI_CSSEL_NCS1,
      |                                         ^~~~~~~~~~~~~~~~~~~
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:420:41: warning: excess elements in struct initializer
/home/user/west_workspace/zephyr/drivers/memc/memc_stm32_xspi_psram.c:420:41: note: (near initialization for 'memc_stm32_xspi_data.hxspi.Init')

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

  • Zephyr 4.3.0-rc3

Additional Context

No response

Metadata

Metadata

Assignees

Labels

area: MEMCbugThe issue is a bug, or the PR is fixing a bugplatform: STM32ST Micro STM32priority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions