Page 1 of 1

How do the HAL based header files work?

Posted: Thu Feb 14, 2019 8:53 pm
by keithnicholas
Is there a good reference somewhere on how the header file system works?

I'm trying to mix C and C++ and cross compile to visual studio for unit testing / simulation

I'm actually having a lot of trouble in TrueStudio trying to get it to compile both C and C++, it seems to get confused about its own header files. But I'm actually unsure how it's intended to be done.

There are these header files

stm32l4xx_hal_conf.h
stm32l4xx_it.h


I seems like stm32l4xx_hal_conf.h should be included in most C files as it #includes the right things based on modules select?
OR
Should each C file #include the specific header files it wants?

If I #include that then I get compile errors like the following

In file included from ../Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h:238:0,
from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h:46,
from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h:45,
from ../Inc/stm32l4xx_hal_conf.h:222,
from ../Inc/adc.h:50,
from ..\Src\adc.c:41:
../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:580:1: error: unknown type name 'HAL_StatusTypeDef'
HAL_StatusTypeDef HAL_Init(void);
^~~~~~~~~~~~~~~~~
../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:581:1: error: unknown type name 'HAL_StatusTypeDef'


I'm really not sure how to resolve them or what is the correct way of doing things

Regards,

Keith