cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler errors on generated project when add HAL header

PaulB
Associate II

I used STM32CubeIDE 1.13.0, STM32CubeMX 6.9.0, software package stm32cube_fw_l4_v1180. 

1. I generated a project for NUCLEO L452 (STM32L452RETxP). Didn't change anything in settings at all.

2. Added a source file test.c that consists of only one line:

#include "stm32l4xx_hal_dma.h"

(You can use any HAL header, not only DMA)

It always caused a lot of errors during compilation.

Can you help me with that issue?

I attached the project.

1 ACCEPTED SOLUTION

Accepted Solutions
JTP1
Lead

Hello

Try to include main.h instead. It will include all HAL modules which are activated in Cube. 

Br JT

View solution in original post

3 REPLIES 3
JTP1
Lead

Hello

Try to include main.h instead. It will include all HAL modules which are activated in Cube. 

Br JT

TDK
Guru

The top-level include should be "stm32l4xx_hal.h". Don't include individual HAL files.

If you feel a post has answered your question, please click "Accept as Solution".
AScha.3
Principal III

after you "generate..." , you write your code to main.c , in core/src/ ... 

no need to include anything, all what you defined to use in Cube is there.

and only (!!) write to area between 

/* USER CODE BEGIN xx */

//here write...

/* USER CODE END xx */

areas , outside it will be away, when you generate again. inside these areas your code remains. 🙂

If you feel a post has answered your question, please click "Accept as Solution".