Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Include Madness

Hi Everbody
i am ripping my hair out to understand whats going on here...
i made a STM32CubeMX project for the STM32F769I-DISCO, with FreeRTOS, imported it,
added the Driver-Things and the Board-Files to the Source-Tree and after
solving some Initializing/Timing-problems with the LCD i got it working, yeah!
next step get stemwin to run, and i am running into some strange include issues...

notice: is there some possibility to post code without formating?

when in the main.c i have
#include “stm32f7xx_hal.h”
#include “cmsis_os.h”
#include “main.h”

/* USER CODE BEGIN Includes main.c*/
#include “stm32f769i_discovery.h”
#include “stm32f769i_discovery_lcd.h”
#include “stm32f769i_discovery_sdram.h”
#include “stm32f769i_discovery_ts.h”
/* USER CODE END Includes */

and the main.h file does not have any includes
it compiles and runs...

BUT...
when i put the includes in the main.h

#ifndef __MAIN_H
#define __MAIN_H
/* USER CODE BEGIN Includes main.h */
#include “stm32f769i_discovery.h”
#include “stm32f769i_discovery_lcd.h”
#include “stm32f769i_discovery_sdram.h”
#include “stm32f769i_discovery_ts.h”
/* USER CODE END Includes */
/* some GPIO-Defines */
#endif /* __MAIN_H */
and just have in main.c
#include “stm32f7xx_hal.h”
#include “cmsis_os.h”
#include “main.h”

i get really strange errors, from files that are not at all realted to main.h (not include from there)

In file included from D:/Arbeit/STM32F769/Workspace/lcd5/Inc/main.h:52:0,
from D:/Arbeit/STM32F769/Workspace/lcd5/Inc/stm32f7xx_hal_conf.h:43,
from D:/Arbeit/STM32F769/Workspace/lcd5/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:48,
from D:/Arbeit/STM32F769/Workspace/lcd5/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c:54:
D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery.h:307:1: error: unknown type name ‘uint32_t’
uint32_t BSP_GetVersion(void);

D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery.h:315:1: error: unknown type name ‘uint32_t’
uint32_t BSP_PB_GetState(Button_TypeDef Button);

In file included from D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_lcd.h:56:0,
from D:/Arbeit/STM32F769/Workspace/lcd5/Inc/main.h:53,
from D:/Arbeit/STM32F769/Workspace/lcd5/Inc/stm32f7xx_hal_conf.h:43,
from D:/Arbeit/STM32F769/Workspace/lcd5/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:48,
from D:/Arbeit/STM32F769/Workspace/lcd5/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c:54:
D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_sdram.h:136:27: error: unknown type name ‘FMC_SDRAM_CommandTypeDef’
uint8_t BSP_SDRAM_Sendcmd(FMC_SDRAM_CommandTypeDef *SdramCmd);

D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_sdram.h:140:27: error: unknown type name ‘SDRAM_HandleTypeDef’
void BSP_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram, void *Params);

D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_sdram.h:141:29: error: unknown type name ‘SDRAM_HandleTypeDef’
void BSP_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram, void *Params);

In file included from D:/Arbeit/STM32F769/Workspace/lcd5/Inc/main.h:53:0,
from D:/Arbeit/STM32F769/Workspace/lcd5/Inc/stm32f7xx_hal_conf.h:43,
from D:/Arbeit/STM32F769/Workspace/lcd5/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:48,
from D:/Arbeit/STM32F769/Workspace/lcd5/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c:54:
D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_lcd.h:344:55: error: unknown type name ‘FunctionalState’
void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State);

D:/Arbeit/STM32F769/Workspace/lcd5/SW4STM32/lcd5/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_lcd.h:388:8: error: unknown type name ‘DMA2D_HandleTypeDef’
extern DMA2D_HandleTypeDef hdma2d_discovery;

make: *** Drivers/STM32F7xx_HAL_Driver/stm32f7xx_hal.o Error 1

the include-Directories are in the Include-searchpath
i am on Win7Pro X64,
ARM Compiler for MCU 1.13.2.201703061529 fr.ac6.feature.mcu.externaltools.armnone.feature.group Ac6
OpenOCD 1.13.1.201703061529 fr.ac6.feature.mcu.externaltools.openocd.feature.group Ac6
OpenSTM32 IDE 1.14.0.201703061529 fr.ac6.feature.mcu.ide.feature.group Ac6
fully updated

many thanks for any enlightment
styro

Hi

I can confirm this stange behavior and interested in an analysis.

Dieter


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}