2017-11-30 02:33 PM
Hi all,
I am using stm32 HAL library in a project with C++14 enabled. It issues me the following warning which I can't get rid of.
../platform/stm32/l4/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h:735:57:
warning: conversion to void will not access object of type 'volatile uint32_t {aka volatile long unsigned int}'
UNUSED(tmpreg); \This happens, when a call to __GPIOX_CLK_ENABLE() or __HAL_RCC_GPIOX_CLK_ENABLE is called.
Has anyone been able to get rid of the above warning leaving the HAL source code intact.
Or any ideas as what is possible to be done.
The current warning level is -Wall.
I've experienced the above issue with both l4 & f4 series code.
Thank you in advance.
#firmware-library #stmf4 #firmware #stm32hal #stml42017-12-03 10:19 PM
I can confirm that this even happens when using eclipse and visualgdb as well.
Therefore I suppose that this is something that is carried along with stm32 source code when C++14 or higher standards is enabled.
Does this mean that STM32 Hal is not updated to work with C++14 or higher standards without warnings.
As for the particular project, I am doing, I am hoping to have zero warnings.
If anyone has a workaround other than falling back to C++11, much appreciated.
Thank you.
2018-03-15 09:52 AM
I changed:
#define UNUSED(x) ((void)(x))
to
#define UNUSED(x) ((void*)(&x))
and it seems to work. Not 100% sure if it is OK.
2018-04-22 11:54 PM
Hi Alter,
Thanks for this, but it still seems to need a change in the ST's implementation.
Anyway, I have been able to work around this issue. I could find an acceptable solution by posting this in stackoverflow.
Please have a look at the following.
https://stackoverflow.com/questions/49061212/stm32-hal-library-warning-with-c14-above