Hi all,

SEGGER RTT (https://wiki.segger.com/RTT) is a software debug mechanism which, 
among other things, exposes convenient virtual terminals. It is implemented as 
ring buffers in RAM. There is a control block with a fixed ID so it can be 
located by the RTT viewer (which runs on your PC, for example) at runtime.

I'm considering what it would take to implement an RTT viewer in qemu. Some 
small parts would be easy:

- Add a '-rtt' command line option
- Use address_space_read or flatview_* stuff to locate the fixed ID in the 
control block

But I don't yet know enough about QEMU to understand some bigger picture things:

- I assume the code for reading messages would need to live in a QemuThread? 
- Where would I output virtual terminal messages to?
- In the case of bidirectional communication, how would a user input messages 
to send to the emulated device?
- Is there a way to monitor memory ranges for changes, or would I need another 
way to detect when new messages are in the ring buffer?

Another possibility (which would avoid the last 3 issues, but of course create 
more complexity in other areas) is to have QEMU emulate a SEGGER J-LINK and 
provide a TCP/IP endpoint that a real RTT Viewer could connect to 
(https://www.segger.com/products/debug-probes/j-link/tools/rtt-viewer/). I'm 
not sure how feasible this is, though.

If anyone has any thoughts or guidance I'd appreciate it.

Thanks,
Chris

Reply via email to