cancel
Showing results for 
Search instead for 
Did you mean: 

_gettimeofday_r error come while i am building with latest stm cube ide

kchin.2
Associate II

stmcube ide 1.13.1

.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+fp/hard\libc_nano.a(libc_a-gettimeofdayr.o): in function `_gettimeofday_r':

17 REPLIES 17
Riscy00_UPP
Associate III

I would like to help other so I created the gettimeofday.c and then added a function that return just 0 since I'm not using it but it resolve compiler error with some peace of mind. 

#include <sys/time.h>

int _gettimeofday( struct timeval *tv, void *tzvp )
{
    // you can add code here there many example in google search. 
    return 0;  // return non-zero for error
} // end _gettimeofday()

 

Gnahore
Senior

Same issue for me

Andri
Associate

Same issue here after IDE upgrade to 1.13.2.

 

C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(libc_a-gettimeofdayr.o): in function `_gettimeofday_r':
(.text._gettimeofday_r+0xe): warning: _gettimeofday is not implemented and will always fail

 

Please help to solve. Thanks.

you can read...?  >>

You can ignore it unless you want to use gettimeofday, in which case you have to implement it yourself for an embedded system :).

or if you trust more in compiler :

warning: _gettimeofday is not implemented and will always fail.

solution is : write it yourself.

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

Our application doesn't use gettimeofday. It's not clear to us why we need to implement it.

Thanks.

Made a new gettimeofday.c source file in src folder and this worked, thanks!

The first line is an error not a warning so you can't ignore it as you suggested: 

in function `_gettimeofday_r'

So is the solution provided by Lab1tr the right one?

Patrice LF
ST Employee

 

Hi,

If you are using mbedTLS a solution to get rid of this warning is to not activate MBEDTLS_HAVE_TIME and MBEDTLS_HAVE_TIME_DATE in mbedtls_config.h

regards

Patrice