<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> + Special registers<br>
Yes, this might be the issue, specifically if the port is using<br>
interrupts. For example, mstatus/mcause/mepc might need to be saved<br>
and/or reset.<br>
<br>
What I'm suspicious of is that the trap_entry code is the problem,<br>
since it didn't have a chance to get executed/tested on my Spike<br>
(dummy clock simulated) BSP/Spike, especially after updating the port<br>
from 2015 to 2017 (RISC-V ABI has changed).<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
><br>
> If it is not preserved across a subroutine call, then it does not have to be<br>
> in the context switch but is in the ISR context.<br>
><br>
> If it is preserved across subroutine calls, then it is in the context<br>
> switch.<br>
><br>
> Special registers have to be analyzed. Some may have a magic value across<br>
> the entire system life. Others will require special handling.<br>
><br>
> Every register needs to be logically places in a class for management<br>
> purposes.<br>
><br>
><br>
>> As for now, I am getting an error on mret instruction, I will try to<br>
>> figure<br>
>> out tomorrow, why it happens.<br>
>> Also, in my debugger 'display /i $pc' suddenly started to work properly.<br>
>> So, now I can debug a bit more efficient.<br>
>> --<br>
>> Regards, Denis Obrezkov<br>
><br>
><br>
><br>
> --<br>
> Hesham<br>
><br>
><br>
<br>
<br>
<br>
</div></div><span class="gmail-HOEnZb"><font color="#888888">--<br>
Hesham<br>
</font></span></blockquote></div>Hello, interrupt-driven clock driver works to some extent!</div><div class="gmail_extra"><br></div><div class="gmail_extra">
<p style="margin:0px">*** LOW MEMORY CLOCK TICK TEST ***</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:00 12/31/1988</p>
<p style="margin:0px">TA2 - rtems_clock_get_tod - 09:00:00 12/31/1988</p>
<p style="margin:0px">TA3 - rtems_clock_get_tod - 09:00:00 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:04 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:09 12/31/1988</p>
<p style="margin:0px">TA2 - rtems_clock_get_tod - 09:00:10 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:14 12/31/1988</p>
<p style="margin:0px">TA3 - rtems_clock_get_tod - 09:00:15 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:19 12/31/1988</p>
<p style="margin:0px">TA2 - rtems_clock_get_tod - 09:00:20 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:24 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:29 12/31/1988</p>
<p style="margin:0px">TA3 - rtems_clock_get_tod - 09:00:30 12/31/1988</p>
<p style="margin:0px">TA2 - rtems_clock_get_tod - 09:00:30 12/31/1988</p>
<p style="margin:0px">TA1 - rtems_clock_get_tod - 09:00:34 12/31/1988</p>
<p style="margin:0px">*** END OF LOW MEMORY CLOCK TICK TEST ***</p>
<p style="margin:0px">Fatal Error 5.0 Halted</p><div><br></div><div>I've started to save and restore mepc and mcause registers, though, they are handled differently in theĀ </div><div>provided example.</div><div><br></div><div>Also, the optimized version doesn't work.</div>-- <br><div class="gmail_signature">Regards, Denis Obrezkov</div>
</div></div>