cancel
Showing results for 
Search instead for 
Did you mean: 

Where is the "stm32l5xx_hal.h"?

MQi.1
Senior II

I made a project based on NECLEO STM32L552ZE-Q, when I made it from MX configuration tool, I found there was no "stm32l5xx_hal.h", while it was included in main.c, where could I find it?0693W000006HUTzQAO.png

14 REPLIES 14
MQi.1
Senior II

here is the prompt in console:

08:39:20 **** Incremental Build of configuration Debug for project test_TrustZone-1_NonSecure ****
make -j8 all 
arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32L552xx -DDEBUG -c -I../Core/Inc -I../../Secure_nsclib -I../../Drivers/STM32L5xx_HAL_Driver/Inc -I../../Drivers/CMSIS/Device/ST/STM32L5xx/Include -I../../Drivers/STM32L5xx_HAL_Driver/Inc/Legacy -I../../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
In file included from ../../Drivers/CMSIS/Device/ST/STM32L5xx/Include/stm32l5xx.h:98:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_def.h:34,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_rcc.h:29,
                 from ../Core/Inc/stm32l5xx_hal_conf.h:246,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/CMSIS/Device/ST/STM32L5xx/Include/stm32l552xx.h:1893:29: error: expected declaration specifiers or '...' before '(' token
 #define GPIOC_NS            ((GPIO_TypeDef *) GPIOC_BASE_NS)
                             ^
../../Drivers/CMSIS/Device/ST/STM32L5xx/Include/stm32l552xx.h:2631:40: note: in expansion of macro 'GPIOC_NS'
 #define GPIOC                          GPIOC_NS
                                        ^~~~~~~~
../Core/Inc/main.h:72:29: note: in expansion of macro 'GPIOC'
 #define LED_GREEN_GPIO_Port GPIOC
                             ^~~~~
../Core/Src/main.c:55:20: note: in expansion of macro 'LED_GREEN_GPIO_Port'
 HAL_GPIO_TogglePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin);
                    ^~~~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:250:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_gpio.h:92:36: error: expected declaration specifiers or '...' before '(' token
 #define GPIO_PIN_7                 ((uint16_t)0x0080)  /* Pin 7 selected    */
                                    ^
../Core/Inc/main.h:70:23: note: in expansion of macro 'GPIO_PIN_7'
 #define LED_GREEN_Pin GPIO_PIN_7
                       ^~~~~~~~~~
../Core/Src/main.c:55:41: note: in expansion of macro 'LED_GREEN_Pin'
 HAL_GPIO_TogglePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin);
                                         ^~~~~~~~~~~~~
../Core/Src/main.c: In function 'main':
../Core/Src/main.c:103:41: error: 'InputChar' undeclared (first use in this function)
    while (HAL_UART_Receive (&hlpuart1, &InputChar, 1, 1000) == HAL_OK)
                                         ^~~~~~~~~
../Core/Src/main.c:103:41: note: each undeclared identifier is reported only once for each function it appears in
../Core/Src/main.c:105:22: error: 'Status' undeclared (first use in this function); did you mean 'ITStatus'?
     if (InputChar != Status)
                      ^~~~~~

MQi.1
Senior II

and these:

ITStatus
../Core/Src/main.c:108:37: warning: pointer targets in passing argument 2 of 'HAL_UART_Transmit' differ in signedness [-Wpointer-sign]
       HAL_UART_Transmit (&hlpuart1, "\r\n to be switched to S world.");
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: expected 'uint8_t * {aka unsigned char *}' but argument is of type 'char *'
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:108:7: error: too few arguments to function 'HAL_UART_Transmit'
       HAL_UART_Transmit (&hlpuart1, "\r\n to be switched to S world.");
       ^~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: declared here
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:110:37: warning: pointer targets in passing argument 2 of 'HAL_UART_Transmit' differ in signedness [-Wpointer-sign]
       HAL_UART_Transmit (&hlpuart1, "\r\n to be switched to NS world.");
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: expected 'uint8_t * {aka unsigned char *}' but argument is of type 'char *'
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:110:7: error: too few arguments to function 'HAL_UART_Transmit'
       HAL_UART_Transmit (&hlpuart1, "\r\n to be switched to NS world.");
       ^~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: declared here
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:112:6: warning: implicit declaration of function 'SECURE_RetargetISR' [-Wimplicit-function-declaration]
      SECURE_RetargetISR (InputChar);
      ^~~~~~~~~~~~~~~~~~
../Core/Src/main.c:116:36: warning: pointer targets in passing argument 2 of 'HAL_UART_Transmit' differ in signedness [-Wpointer-sign]
       HAL_UART_Transmit(&hlpuart1, "\r\n User Button has been switched to S world.");
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: expected 'uint8_t * {aka unsigned char *}' but argument is of type 'char *'
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:116:7: error: too few arguments to function 'HAL_UART_Transmit'
       HAL_UART_Transmit(&hlpuart1, "\r\n User Button has been switched to S world.");
       ^~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: declared here
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:118:36: warning: pointer targets in passing argument 2 of 'HAL_UART_Transmit' differ in signedness [-Wpointer-sign]
       HAL_UART_Transmit(&hlpuart1, "\r\n User Button has been switched to NS world.");
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: expected 'uint8_t * {aka unsigned char *}' but argument is of type 'char *'
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:118:7: error: too few arguments to function 'HAL_UART_Transmit'
       HAL_UART_Transmit(&hlpuart1, "\r\n User Button has been switched to NS world.");
       ^~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: declared here
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:121:36: warning: pointer targets in passing argument 2 of 'HAL_UART_Transmit' differ in signedness [-Wpointer-sign]
       HAL_UART_Transmit(&hlpuart1, "\r\n the same state, do nothing. \n");
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: expected 'uint8_t * {aka unsigned char *}' but argument is of type 'char *'
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
../Core/Src/main.c:121:7: error: too few arguments to function 'HAL_UART_Transmit'
       HAL_UART_Transmit(&hlpuart1, "\r\n the same state, do nothing. \n");
       ^~~~~~~~~~~~~~~~~
In file included from ../Core/Inc/stm32l5xx_hal_conf.h:402:0,
                 from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,
                 from ../Core/Inc/main.h:31,
                 from ../Core/Src/main.c:21:
../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal_uart.h:1581:19: note: declared here
 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
                   ^~~~~~~~~~~~~~~~~
make: *** [Core/Src/subdir.mk:33: Core/Src/main.o] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
 
08:39:21 Build Failed. 10 errors, 6 warnings. (took 574ms)
 

TDK
Guru

It shows right in the console output:

from ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h:30,

The "Drivers" folder is a top-level folder within your project.

You've got some other usage errors happening. HAL_UART_Transmit requires a pointer, a length, and a timeout value. You're just trying to pass a raw string, which isn't even the right number of arguments.

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

Double check what modules are enabled in your project's stm32l5xx_hal_conf.h

This needs a timeout parameter

HAL_UART_Transmit(&hlpuart1, "\r\n the same state, do nothing. \n");

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes, I found it, but the others are all set the same way, since this pin I used, so does that mean the configuration would rewrite the file "stm32l5xx_hal.h", and so my configuration has errors?

0693W000006HXZgQAO.png

"This needs a timeout parameter"

For such error, Where could I get the HAL functions prototype(the documents) ?

MQi.1
Senior II

Now, it shown:"../Core/Src/main.c:121:28: error: 'hlpuart1' undeclared (first use in this function)", should I declared a "hlpuart1" object of "HLPUART" in main.c or main.h? Since I hasn't found it in " ../../Drivers/STM32L5xx_HAL_Driver/Inc/stm32l5xx_hal.h".

MQi.1
Senior II

for "Double check what modules are enabled in your project's stm32l5xx_hal_conf.h", I found these, is it enough?

#ifdef HAL_UART_MODULE_ENABLED

 #include "stm32l5xx_hal_uart.h"

#endif /* HAL_UART_MODULE_ENABLED */

#ifdef HAL_USART_MODULE_ENABLED

 #include "stm32l5xx_hal_usart.h"

#endif /* HAL_USART_MODULE_ENABLED */

TDK
Guru

HAL is open source, you can look at the source files directly to see how to use them. F3 will jump to the definition. There are also quite a few examples in the CubeMX repository that you can look at, although the L5 is relatively new and may not have as many as the other families.

If you enable these things within CubeMX, it will generate the code you need to run them, such as the definition of hlpuart1. That would probably be the easiest method to get started.

As far as what modules are enabled, your code snippet doesn't provide that info. Are the HAL_UART_MODULE_ENABLED and HAL_USART_MODULE_ENABLED #defines enabled? They would be higher up in that file.

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