On a SAM4C microcontroller platform the time()
function is called within a library. I found out, that this gives the right time (1496321612
) when I start from debugger. However, when I make a hardware reset on the board, and the flashed firmware executes without debugger, time()
doesnt return and the firmware stucks at this point.
I wonder how time is set at all. I debug only via ATMEL JTAG ICE (Segger)
and do not set the time explicitly. When I change date on my PC I get back a different time while debugging...Is there an automatic mechanism that sets time from my PC when a debug session gets started by the Segger ICE and why is my firmware crashing when time is not set?
This can be achieved using the mechanism called semi-hosting. Overall the mechanism is allowing the target to use some facilities available on the host computer (the one running the debugger HW/SW). The simplified mechanism is like the following: