cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler errors: unknown type name 'HAL_LockTypeDef' and 'HAL_StatusTypeDef' using CubeMX and Atollic TrueSTUDIO 7.1

joseph23
Associate II
Posted on August 11, 2017 at 17:36

I'm attempting to compile a STM32F303RE project using the Cube MX generated HAL drivers for Atollic TrueStudio 7.1. I'm getting 39 errors on stm32f3xx_hal_dma.h, stm32f3xx_hal_uart.h, and

stm32f3xx_hal_uart_ex.h wherever a HAL_StatusTypeDef or HAL_LockTypeDef type is referenced.

>:(

Each header file that has these errors has a #include 'stm32f3xx_hal_def.h' where the type is defined at the top of the file.

This seems to be related to using the HAL drivers in source files other than main.c. I've created a bare bones blinky project using CubeMX and I initially had the same errors, until Iincludedstm32f3xx_hal.h in the external source file that I created that calls the HAL driver functions. Unfortunately this solution didn't work with my more complicated project.

If the header file defining the type is right there, why in the world would the compiler not see it? I feel like I'm missing something really basic, but I can't figure this out. Any help would be greatly appreciated!

Note: this post was migrated and contained many threaded conversations, some content may be missing.
21 REPLIES 21
Posted on July 06, 2018 at 13:19

Hi

moritz.struebe

,

I marked this question for action to review it later.

The action from my side is resolved as I haven&39t so much things to add. But your question remains open as you didn&39t selected one of the answers as correct.

In STM32Cube packages we have an inclusion model that has to be respected.

It is described in

https://www.st.com/resource/en/user_manual/dm00122016.pdf

for STM32CubeF3 (Paragraph: File inclusion model).

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

Posted on July 06, 2018 at 13:45

Ok, I see (although I strongly disagree with the design decision).  Yet in that case stm32f3xx_hal_def.h should not include stm32f3xx.h in line 46.

Also something like

♯ ifndef __STM32F3xx_HAL_H

♯ warning Please do not include this file directly but stm32f3xx.h. See UM 1786.

♯ endif

would be nice.