pussuw commented on PR #8762:
URL: https://github.com/apache/nuttx/pull/8762#issuecomment-1461671859

   > I can't seem to set the compare register for m-timer. As a workaround, I'm 
using the peripheral timer, timer0.
   
   Like I said in the issue you posted, you need an SBI implemenation in order 
to access machine mode. OpenSBI is one option, I use that. Basically the 
hardware starts executing code from OpenSBI and NuttX becomes a binary payload, 
OpenSBI then jumps to NuttX and changes mode from M -> S. Access to M-mode 
(e.g. mtimer) is done via ecall to M-mode.
   
   I have also implemented a native and very stripped down SBI for NuttX but 
that has not been upstreamed as it is totally proprietary and integrates to the 
NuttX build system, which is not semantically correct. If there is a general 
desire for this SBI version I can of course provide it but I will not do any 
further work towards making it conform to the OpenSBI "standard" (it's not a 
standard...) implementation.
   
   > Interrupts with the PLIC are not reliable.
   
   At least with MPFS the PLIC memory mapped registers are duplicated / 
shadowed to two locations, one for S-mode and one for M-mode access. Maybe 
something worth looking into.
   
   qemu for whatever reason allows/handles the access from S -> M mode, maybe 
@masayuki2009 can explain how that actually works. I think there is something 
in the command line options that allows this. 
   
   For actual hardware this obviously will not do. You need to select or 
implement the SBI and then integrate it to your system.
   
   As @masayuki2009 (afaik) is the one who did the qemu-rv implementation maybe 
he can explain the pitfalls / caveats when moving to actual hardware from that.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to