Page 1 of 1
XRoar API ?!?
Posted: Thu Jul 24, 2014 7:06 pm
by jedie
What's about to add a API in XRoar, so that e.g. a Python script can interact with the simulated machine?
Re: XRoar API ?!?
Posted: Thu Jul 24, 2014 8:17 pm
by sixxie
Well the GDB interface already exists...
https://sourceware.org/gdb/onlinedocs/g ... tocol.html for the general approach and check the top of gdb.c for XRoar specifics.
You'd doubtless want more hardware inspection commands - outside the CPU, the only one there at the moment is query/set of the SAM register, but more can be added.
Re: XRoar API ?!?
Posted: Thu Jul 24, 2014 8:39 pm
by jedie
GDB is very low level and more for debugging. Isn't it?
I mean something like:
* stop/resume machine
* read/write machine RAM/ROM
* raise software reset
Re: XRoar API ?!?
Posted: Fri Jul 25, 2014 12:38 pm
by sixxie
jedie wrote:GDB is very low level and more for debugging. Isn't it?
It's low level, but it'll do what you want:
I mean something like:
* stop/resume machine
Send an BREAK (0x03), send continue ('c').
* read/write machine RAM/ROM
'm' and 'M' - though if you want to write ROM, I'd need to extend that.
* raise software reset
Not directly supported at the mo, though you could obviously set PC to an appropriate value. Extending to support a particular signal type could impose a full reset.
GDB itself is the program that does the debugging - it does it by stopping/starting the target and reading/writing memory in the way you want.
The GDB packet format is very simple, and operates over a simple TCP connection.
..ciaran
Re: XRoar API ?!?
Posted: Fri Jul 25, 2014 2:01 pm
by jedie
Hm. Seems to be interesting. I will take a look, thanks!
Re: XRoar API ?!?
Posted: Sat Jul 26, 2014 11:20 am
by jedie
I have no experience in this.
I created a first test script in Python, here:
https://github.com/jedie/PyDragon32/blo ... b_tests.py
I just send a "g" and get '$S02#b5' back. This seems to be wrong.
Can you give some examples?
Re: XRoar API ?!?
Posted: Sun Jul 27, 2014 1:16 pm
by tormod
As an alternative path, you might be interested in gdb's support for python scripting:
https://sourceware.org/gdb/current/onli ... tml#Python In this case you would run python scripts from inside gdb and you wouldn't need to take care of the low-level communication.
Your m6809-gdb will have to be compiled with python support (Ciaran's binaries are not).