Current time in Zephyr using ARM Qemu board


aska.wu
 

Hi,

You probably can try this PR https://github.com/zephyrproject-rtos/zephyr/pull/1502 if you want to manage system time by gettimeofday()/settimeofday(). Note that It's still under review and only works for cortex-m boards for the time being.

Aska Wu


On Wed, 18 Oct 2017 at 22:26 Hui Yie Teh <hteh703@...> wrote:
Hi,

I am trying to get the current time using the following:

time_t rawtime; 
struct tm *info;
time( &rawtime );
info = localtime( &rawtime );
printf("Current local time and date: %s", asctime(info));

However, this is giving me an error on Qemu:

qemu: fatal: Trying to execute code outside RAM or ROM at 0x05252ff4

Is there a reason for this? Also, is there another way to get the current time of the system in Zephyr?

Any help would be much appreciated.

Cheers,
Yie
_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


Paul Sokolovsky
 

Hello,

On Thu, 19 Oct 2017 03:26:09 +1300
Hui Yie Teh <hteh703@...> wrote:

Hi,

I am trying to get the current time using the following:

time_t rawtime;
struct tm *info;
time( &rawtime );
info = localtime( &rawtime );
printf("Current local time and date: %s", asctime(info));

However, this is giving me an error on Qemu:

qemu: fatal: Trying to execute code outside RAM or ROM at 0x05252ff4
Did you try to run your app under debugger and see what happens there?


Is there a reason for this? Also, is there another way to get the
current time of the system in Zephyr?

Any help would be much appreciated.

Cheers,
Yie


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Yie
 

Hi,

I am trying to get the current time using the following:

time_t rawtime; 
struct tm *info;
time( &rawtime );
info = localtime( &rawtime );
printf("Current local time and date: %s", asctime(info));

However, this is giving me an error on Qemu:

qemu: fatal: Trying to execute code outside RAM or ROM at 0x05252ff4

Is there a reason for this? Also, is there another way to get the current time of the system in Zephyr?

Any help would be much appreciated.

Cheers,
Yie