Interrupts strange behavior on RISC-V

Denis Obrezkov denisobrezkov at
Sat Jul 8 15:09:54 UTC 2017

Hello all,
I worked with local interrupts last few days and found some strange

I am trying to handle local interrupts.
That's what I do, in my handler for timer interrupts:
* disable timer interrupts in mie
* read a current value from mtime
* copy it to mtimecmp (both are 64bit width types)
* add some big value to mtimecmp
* enable timer interrupts in mie.

And I have two boards and the problem is that on one of them interrupts are
permanently generated because mip register is always 1 in mtip position,
though mtimecmp is greater than mtime, and are not generated at all on the

In this piece of code, I turn on interrupts:
la t0, RISCV_Exception_default
csrs mtvec, t0
li t0, 0x88
csrs mie, t0
csrsi mstatus, 0x8

My start file:

and ISR:

I also posted this question here:

Regards, Denis Obrezkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list