Other Parts Discussed in Thread: SYSBIOS
Hi,
I'm trying to display the local time on the screen of my development kit.
I got the following code from one of the man pages for ti/sysbios/hal/Seconds
#include <ti/sysbios/hal/Seconds.h> #include <time.h>
// ... time_t t; struct tm *ltm; char *curTime; t = time(NULL); ltm = localtime(&t); curTime = asctime(ltm); System_printf("Time(GMT): %s\n", curTime); System_flush();
which works just how I'd expect it to and puts the time in the console.
However, if I try and call the exact same code as above from within a clock function or an idle callback, I get
Unhandled ADP_Stopped exception 0x20023
when stepping over the localtime function call. I have tried to step in, and I get no file. Included, however, is the disassembly in case that helps.
localtime():
0000dd5c: B510 push {r4, lr}
0000dd5e: 4604 mov r4, r0
57
0000dd60: F7F6F9B8 bl #0x40d4
0000dd64: F100017C add.w r1, r0, #0x7c
0000dd68: 4620 mov r0, r4
58 _REENT_CHECK_TM(reent);
0000dd6a: E8BD4010 pop.w {r4, lr}
57
0000dd6e: F000B801 b.w localtime_r
0000dd72: BF00 nop
17 return _mktm_r (tim_p, res, 0);
And, it dies on the first `bl` in particular.
I have tried digging deeper into that, and it is dying on
Assert_isTrue(((BIOS_getThreadType() != BIOS_ThreadType_Hwi) &&
(BIOS_getThreadType() != BIOS_ThreadType_Swi)),
ReentSupport_A_badThreadType);
But I can't imagine why localtime would be causing an issue here.
Any advice?