cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX removes spi.h include as soon as QUADSPI peripheral is activated

StefanRickli
Associate II

It's not a big deal but this got me confused for a moment when I suddenly got compiler warnings.

Steps to reproduce:

  1. Start a new project in STM32CubeIDE
  2. Use STM32L422RBI MCU, default settings, finish
  3. CubeMX: Enable SPI1 peripheral, Full-Duplex Master, default configuration
  4. CubeMX: Project Manager > Code Generator > Enable "Generate peripheral initialization as a pair of '.c/.h' files per peripheral"
  5. Save IOC, generate code, build project: observe 0 errors, 0 warnings
  6. Note that in Core/main.c, there is a line #include "spi.h"
  7. Open IOC in CubeMX again
  8. CubeMX: Activate QUADSPI peripheral, Bank1 with Single/Dual Lines, default configuration
  9. Save IOC, generate code, build project: observe 0 errors, 1 warning: "implicit declaration of function 'MX_SPI1_Init'; did you mean 'MX_GPIO_Init'? [-Wimplicit-function-declaration]"
  10. Observe that #include "spi.h" has been replaced by #include "quadspi.h"

This can easily be fixed manually by adding the missing include below in the user includes but still, it should be fixed in the CubeMX code generator.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @StefanRickli​ ,

Thanks for your feedback,

This is issue is the same as the one reported in this thread Missing <include "spi.h"> in STM32CubeMX V. 6.4.0. / HAL 1.9.1 (STM32H7). it is already raised to the dev team to be fixed. I will keep you posted with updates.

As you mentioned, the workaround for this issue is to manually add #include "spi.h" in the user section.

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Sara.

View solution in original post

2 REPLIES 2
Sara BEN HADJ YAHYA
ST Employee

Hello @StefanRickli​ ,

Thanks for your feedback,

This is issue is the same as the one reported in this thread Missing <include "spi.h"> in STM32CubeMX V. 6.4.0. / HAL 1.9.1 (STM32H7). it is already raised to the dev team to be fixed. I will keep you posted with updates.

As you mentioned, the workaround for this issue is to manually add #include "spi.h" in the user section.

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Sara.

Sara BEN HADJ YAHYA
ST Employee

Hello ​ @StefanRickli,

This issue is fixed in STM32CubeMX latest release.

V6.5.0 is now available under this Link.

Thanks for your contribution.

Sara.