Loading...
 

STM32MP1 support available in SW4STM32

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world.
And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4; you can download a short video showcasing this on the ac6-tools website (registration required).

System Workbench for STM32


You are viewing a reply to Include Madness  
France

Hi,

It seems the problem is that main.h is included by stm32f7xx_hal_conf.h, itself included by stm32f7xx_hal.h (see the error message above) and that it includes stm32f769i_discovery.h which needs types that are defined by (possibly indirectly) by stm32f7xx_hal.h but after it includes main.h (which is probably expected to parameterize it).

So in main in the first case include files are:

  • stm32f7xx_hal.h
    • stm32f7xx_hal_conf.h
      • main.h
  • stm32f769i_discovery.h

so when this last file was included, stm32f7xx_hal.h was fully parsed and all works well, while in the second case include files are:

  • stm32f7xx_hal.h
    • stm32f7xx_hal_conf.h
      • main.h
        • stm32f769i_discovery.h

and it does not work because, when stm32f769i_discovery.h is included, stm32f7xx_hal.h and stm32f7xx_hal_conf.h are not yet fully included...

There’s no simple cure for that as multiple-inclusion prevention will not permit to include stm32f7xx_hal.h from main.h (it will be skipped as you are already in the process of including it, altough not yet fully). The best would be to place all your application-specific include files in a new include file (say app.h) containing, for example
#ifndef __APP_H
#define __APP_H

#include "stm32f7xx_hal.h"
#include "cmsis_os.h"
#include "stm32f769i_discovery.h"
#include "stm32f769i_discovery_lcd.h"
#include "stm32f769i_discovery_sdram.h"
#include "stm32f769i_discovery_ts.h"

#endif /* __APP_H */
and just have in main.c
#include "stm32f7xx_hal.h"
#include "cmsis_os.h"
#include "main.h"

/* USER CODE BEGIN Includes main.c*/
#include "app.h"
/* USER CODE END Includes */

while main.h is left untouched (that is without any user includes).

Hope this helps,

Bernard (Ac6)

PS: To format code just place it between {CODE()} and {CODE}