I am working on building a processor, as a pasttime project. The thing is going to have a Mips isa and will probably use uart to communicate with the host machine.
Let us say that I actually get to a somewhat working CPU, then I want to run GDB to debug the code (and the CPU, probably). I have worked with embedded processors and used programs such as OpenOCD and JLink, both of which provide a tcp port to connect GDB to and then you can start debugging.
What would be ways for me to implement such a gdb server for my (or any) new platform? Extending OpenOCD? Is there documentation about what GDB expects when connecting to a remote target?