On May 26, 2012, at 23:50 , Tomek CEDRO wrote:
> Please see how OpenOCD is organized, take a look at TARGET first,
I did, and the the gdb_breakpoint...() calls target_add_breakpoint() both in
the main repo and in your fork.
> I think this is TRANSPORT layer that should be responsible for TARGET
> commands processing. And TARGET can decide on how to process the commands -
> if INTERFACE is intelligent TRANSPORT will simply pass commands to INTERFACE,
> if INTERFACE is dump then transport will generate bitstream for INTERFACE.
> With this approach the code is already there, just need some better
> organization :-)
it sounds similar to my proposal, except that you did not define how high the
Interface.Transport API should go.
in my proposal, the gdb_breakpoint...(), virtually calls
Interface.addBreakpoint().
the actual implementation will probably marshal the params and call a single
function like
bool processed = Interface.processCommand(cmd, request_t* request,
response_t* response))
if the interface is able to directly process the command it returns false, and
the code will call
bitstream = Target.makeBitstream(cmd, Transport)
processed = Interface.Transport.bitstreamCommand(bitstream, ...)
which will create the bitstream and try to send it in one transaction (2 for
swd). Transport differentiates between JTAG/SWD/SPI/etc
if this again fails, then bitbang should be used, by iterating the bitstream
and, according to the current Transport, call
Interface.bitbang(...)
obviously the implementation details are to be fixed, but the Interface seems
to play the major role.
libswd, together with what can be isolated from the existing code as libjtag,
can provide the transport specifics. a common API for them would be even better.
even if the implementation is in plain C, I still thing that an object oriented
design might be benefitial, at least to define the layers and the relationships
between them.
regards,
Liviu
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel