Undefined reference to 'settimeofday' in i.MX RT1060

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Undefined reference to 'settimeofday' in i.MX RT1060

Jump to solution
1,391 Views
pratik040391
Contributor II

Hi,

I am working on SLN-VIZNLC-IOT kit and making some modifications on the display. One of the requirements we have is to display time on the screen.

To Set the time in the system I am calling "settimeofday()" API from <sys/time.h>. But, while compiling the code I am getting below error

 

c:/nxp/mcuxpressoide_11.7.1_9221/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.7.1.202301190959/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: ./source/main.o: in function `APP_BoardInit()':
D:\Face_detection\Debug/../source/main.cpp:69: undefined reference to `settimeofday'

 

But I am able to use "time()" API from <time.h>

Is there any specific flag or any other thing require to enable this?

 

Thanks,

Pratik

Labels (1)
0 Kudos
Reply
1 Solution
1,329 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @pratik040391 ,

   Thanks for your information.

   I don't think that can be supported in the solution SDK demo directly, as that is just an interface, but no the real resource for the time input.

  So, still as I told you, if you need the time, use the external calendar chip to read it, then display it on the LCD, if the calendar uses pure software, no external chip, it is not very convenient.

Wish it helps you!

Best Regards,

Kerry

View solution in original post

0 Kudos
Reply
7 Replies
1,360 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @pratik040391 ,

  Where you find "settimeofday()" API from <sys/time.h>?

  I didn't find the sys, time.h from the SDK in the Github:

https://github.com/NXP/mcu-viznlc

  Please help to check the sys/time.h source code, thanks. Seems our SDK didn't support it.

Best Regards,

Kerry

0 Kudos
Reply
1,359 Views
pratik040391
Contributor II

Thanks @kerryzhou for the response.

If this API is not being supported by SDK then Is there an alternative to set system time?

 

Thanks,

Pratik

0 Kudos
Reply
1,349 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @pratik040391 ,

   The settimeofday, do you find it from the SDK?

   As I and the solution team didn't find this API, do you find it in the SDK? If yes, let me know the file path, thanks, we will check it.

   If the SDK is not support the settime, then you need to add it by yourself, eg, add the calendar chip, then you can read the daytime from the calendar chip directly, then you just need to display it.

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos
Reply
1,346 Views
pratik040391
Contributor II

Hi @kerryzhou 

I can not find the source code in the sdk. But, I can find "sys/time.h" at below location,

C:\nxp\MCUXpressoIDE_11.7.1_9221\ide\plugins\com.nxp.mcuxpresso.tools.win32_11.7.1.202301190959\tools\arm-none-eabi\include\sys

So, When I am adding this API, it will find declaration from above path but when I try to compile the it gives me an undefined reference error.

Thanks,

Pratik

0 Kudos
Reply
1,330 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @pratik040391 ,

   Thanks for your information.

   I don't think that can be supported in the solution SDK demo directly, as that is just an interface, but no the real resource for the time input.

  So, still as I told you, if you need the time, use the external calendar chip to read it, then display it on the LCD, if the calendar uses pure software, no external chip, it is not very convenient.

Wish it helps you!

Best Regards,

Kerry

0 Kudos
Reply
1,311 Views
pratik040391
Contributor II

@kerryzhou Thank you for the explanation and suggestion. Currently I have added timer based counter to handle the clock.

Thanks,

Pratik

0 Kudos
Reply
1,362 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @pratik040391 ,

   From your description, seems lack the definition, do you add the header file in the main.cpp?

  I mean, sys/time.h in the main.cpp.

  I also help you to check with our internal solution team, I get the answer that, this function is not added in the solution, so, need the customer to write the related code and display it.

 

Wish it helps you!

Best Regards,

Kerry

0 Kudos
Reply