Hi all,

Part of my impetus to restructure the command set is to see more
separation of policy and mechanism in the code.  The JTAG layer shows
how this can be done: a tcl.c file contains all of the command handlers,
while core.c contains the low-level functions that do the work.  It
might be worth considering a cmd.c file with the high-level command
handlers, if they can become fully independent of the Jim APIs. 

After the command cleanup that I have started, I believe this type of
factoring deserves to be pursued in the other modules.  I propose making
these changes in the following order:

 - svf, xsvf, pld: simple core/tcl separation: */core.c and */tcl.c
 - flash/nor, flash/nand: likewise, if renamed; otherwise *_{core,tcl}.c
 - target.c: split into target/core.c and target/tcl.c
 - split drivers similarly: <driver>.c and <driver>_tcl.c

This suggestion helps show why it would be nice to split the flash/
directory contents into subdirectories.  While it paves the way for
future types of flash, it allows us to provide them with their own
{core,tcl}.c files and provide normalized names for all modules' layers.

This plan would transform each OpenOCD library module to have the same
file structure in this way, creating a clear division between the
low-level model (in core.c) and the view/controller (in tcl.c).  This
division is blurred too often today, with the result that a lot of code
does not promote (or practice) re-use as widely or often as it can.

It also becomes conceivable to provide a '--disable-tcl' option to build
a version of the libraries that do not contain this high-level code.
I have said this before, but I feel it is an imperative to pursue this
strictly for the purpose of improving OpenOCD's architectural integrity.

Cheers,

Zach
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to