Other Parts Discussed in Thread: SYSBIOS
I am working with the DK-TM4C129X, and am using IAR with the I-jet JTAG for debug.
I am working through how to initialize the system time within TI-RTOS so that when I call the C library "time" function from time.h, it returns the seconds since 1970 with somewhat reasonable accuracy. The system time would be set based on a command that is received over one of the UARTs.
Just for kicks, I called the time function, and printf-ed the result with the following:
time_t my_time = time(NULL);
printf("time: %s\r\n", ctime(&my_time));
To my surprise, the time printed out the console was very accurate relative to the time on the laptop that I am developing on. This was originally surprising since there is no hardware or battery on the DK-TM4C129X which keeps track of time. Obviously, the IAR debugger must be settings the time based on laptop time, and if I run the application without the I-jet JTAG attached, the same code above shows "Wed Dec 31 23:59:59 1969", which is what I expected.
Is there any explanation for how system time is initialized through the debugger, and is it actually the TI-RTOS plug-in that does this initialization? I recognize that this may be a question to ask IAR, but I did not initially see anything in the IAR tool or the documentation on this topic. I am curious because I am trying to do exactly what the debugger currently does, and would like to see how it is done.
FWIW, within TI-RTOS it appears the way to set the system time is through the Seconds_set function. I have not explicitly included the Seconds module within my TI-RTOS .cfg file, so I was wondering whether this is included implicitly through another module, or whether the debugger is using some other method altogether to set the system time.
Thanks in advance.