cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMx generated code for STM32h7 when QuadSPi enabled but sd card disabled not compiling (perhaps bug in generated code)

RMart.0
Associate III

When I generate code for the STM32h750 via cubeMX, I see in stm32h7xx_ll_delayblock.h:

#if defined(HAL_SD_MODULE_ENABLED) || defined(HAL_QSPI_MODULE_ENABLED)

I have QSPI enabled, but SD disabled, and the code following the #if is accounted for in the compilation, as expected. This code makes use of a const called DLYB_MAX_UNIT.

The issue is that stm32h7xx_ll_delayblock.h, which contains the definition for DLYB_MAX_UNIT is never included when SD is disabled.

This seems to be a bug either in the #if mentioned above (which should not contain the || defined(HAL_QSPI_MODULE_ENABLED)) or in the stm32h7xx_hal_qspi.h file, which does not include "stm32h7xx_ll_delayblock.h".

Notice that if SD card is enabled, the code should compile because of the following lines in stm32h7xx_hal_sd.h:

#if defined (DLYB_SDMMC1) || defined (DLYB_SDMMC2) || defined (DLYB_SDMMC3)

#include "stm32h7xx_ll_delayblock.h"

#endif /* (DLYB_SDMMC1) || (DLYB_SDMMC2) */

My STM32H7 package is V1.5.0

1 ACCEPTED SOLUTION

Accepted Solutions
RMart.0
Associate III

The issue can not be reproduced after updating to cubemx 5.4 and STM32H7 package V1.6.0

View solution in original post

3 REPLIES 3
Amel NASRI
ST Employee

Hello @RMart.0​ ,

The functions defined in stm32h7xx_ll_delayblock.c are only used with SD module.

I assume that there is no need for the check "defined(HAL_QSPI_MODULE_ENABLED)".

Anyway, it will not generate a compilation error. But I will check with our development team to remove the non-needed check, unless it has a particular use-case that they will explain.

-Amel

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.

Amel NASRI
ST Employee

Reading again the summary of your question: you said that generated code is not compiling.

Could you please share the .ioc file leading to this issue?

-Amel

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.

RMart.0
Associate III

The issue can not be reproduced after updating to cubemx 5.4 and STM32H7 package V1.6.0