Skip to main content
GS1
Senior III
January 21, 2022
Solved

Missing in STM32CubeMX V. 6.4.0. / HAL 1.9.1 (STM32H7)

  • January 21, 2022
  • 10 replies
  • 10512 views

After migrating a project to STM32CubeMX Version 6.4.0 / HAL 1.9.1

or after creation of a new project using the latest version of STM32CubeMX 6.4.0. / HAL 1.9.1. an include for spi.h is missing, which produces a compiler error! In the previous version all was fine.

Processor: STM32H7A3ZITx

activated port: SPI3

and some Timers, USART, CAN, etc.

After Code Creation with the new release, a line is missing in main.h:

#include "spi.h"

Please forward this to your responsibles. Thank you.

BR GS

This topic has been closed for replies.
Best answer by Sara BEN HADJ YAHYA

Hello @GS@S​ ,

This issue is fixed in STM32CubeMX latest release.

V6.5.0 is now available under this Link.

Thanks for your contribution.

Sara.

10 replies

Peter BENSCH
ST Technical Moderator
January 21, 2022

I can't confirm that because spi.h should only be created if you set in CubeMX:

Project Manager > Code Generator > Generate peripheral initialization as a pair of...

If you do not activate this point, spi.h will not be created either and an #include "spi.h" should not appear in any of the created .c/.h files.

Could it be that this is a left-over from a previous project version?

Regards

/Peter

@Sara BEN HADJ YAHYA​ 

@Imen DAHMEN​ 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Sara BEN HADJ YAHYA
ST Technical Moderator
January 21, 2022

Hello @GS@S​ ,

Thanks for your feedback,

As @Peter BENSCH​  mentioned in his comment, the spi.h file is only generated when Project Manager > Code Generator > Generate peripheral initialization as a pair of... field is checked. When it is generated, the include of this file will be called in main.c.

I tried to generate a project with the Project Manager > Code Generator > Generate peripheral initialization as a pair of... is checked and I didn't face any issue.

If this isn't your issue could you please share your .ioc file and provide us with the exact scenario to reproduce it.

If you 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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
GS1
GS1Author
Senior III
January 21, 2022

Hello Sara and Peter,

I checked my project and the option of generating pairs of.. is activated!

I send you my .IOC file so you can check by yourself.

After generating code the main file includes part looks like this:

/* USER CODE END Header */

/* Includes ------------------------------------------------------------------*/

#include "main.h"

#include "adc.h"

#include "dma.h"

#include "fatfs.h"

#include "fdcan.h"

#include "i2c.h"

#include "mdma.h"

#include "octospi.h"

#include "sdmmc.h"

#include "tim.h"

#include "usart.h"

#include "usb_device.h"

#include "gpio.h"

/* Private includes ----------------------------------------------------------*/

...

As said before: the missing spi.h also is coming up after I migrated another project, which before the migration was ok.

BR GS

Sara BEN HADJ YAHYA
ST Technical Moderator
January 24, 2022

Hello @GS@S​ ,

You are right and I confirm the issue, it seems that the spi.h header file is not included in main.c only when OCTOSPI is enabled.

To make sure that the #include "spi.h" will not disappear from main.c after code regeneration, please make sure to add it in the user section code.

/* Private includes ----------------------------------------------------------*/

/* USER CODE BEGIN Includes */

#include "spi.h"

/* USER CODE END Includes */

With this being said, the issue is reported to the dev team to be fixed. I will keep you posted with the updates.

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

Thanks for your contribution,

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Bertrand1
Senior
January 24, 2022

Hello,

Seems have a similar issue. I opened a project in MX6.3/FW1.9.0 for a STM32H747, inside CubeIDE 1.8.

I accept a migration because MX6.4 & FW 1.9.1. Too bad.

After the code regeneration, I was unable to compile.

It seems it change some include path for USB device drivers files & all HAL files moved .

Crazy.

I backup source file with git, but not .project file, so I was unable to retrieve immediatly.

I loose a lot of time.

Regards

Bertrand

GS1
GS1Author
Senior III
January 24, 2022

So you got an important learning effect:

1) NEVER do an upgrade of a project before copying ALL Files of your project to a separte safe-directory. I even use this to see the changes afterwards. I want to know whats going on.

2) Activate the checkbox in the project Manager properties of CubeMX: "Backup previously genterated files when re-generating"

BR GS

Bertrand1
Senior
January 24, 2022

I do it normally but I believed I was backup by my repo....

I forgot "eclipse" file.

But, Yes, it confirmes ( it is not the first time :( ) I am feel partly guilty

Sara BEN HADJ YAHYA
ST Technical Moderator
March 7, 2022

Hello @GS@S​ ,

This issue is fixed in STM32CubeMX latest release.

V6.5.0 is now available under this Link.

Thanks for your contribution.

Sara.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.