Skip to main content
Visitor II
October 28, 2019
Solved

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

  • October 28, 2019
  • 3 replies
  • 1053 views

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

    This topic has been closed for replies.
    Best answer by RMart.0

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

    3 replies

    Technical Moderator
    November 19, 2019

    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

    Technical Moderator
    November 19, 2019

    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

    RMart.0AuthorAnswer
    Visitor II
    January 8, 2020

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