On Thu, Feb 2, 2012 at 4:06 PM, Freddie Chopin <[email protected]> wrote: > W dniu 2012-02-02 21:24, Chris Morgan pisze: > >> Is the idea to allow some kind of function chaining? I guess I'm not >> understanding what the principle use of init_targets() was that makes >> it better than simply executing the code where it was sourced? >> >> Is the idea something like being able to include a board file and then >> run some code after that file has loaded? Isn't that possible by >> sourcing the board file from your tcl file and putting your code >> statements after the 'source' line? >> >> What kinds of problems are you trying to solve? I wouldn't mind >> helping out, I'm adept with git etc, and tcl seems simple, but figure >> we need some architecture idea first. > > > Using init_targets() you can have one generic file that provides some > functions and works alone. You can override the init_targets in this file > with another one, while still using functions from the generic file. > Infinite number of levels can be added. Currently lpc2xxx.cfg holds generic > code for lpc2000 chips (setup_lpc2xxx()) and when run alone it returns an > error - by design. Specific LPC2000 files use this file's functions and > provide another level of abstraction (i.e. setup_lpc2103()). Board files > should (that was the idea) source this file, provide another init_targets() > and use setup_... function from target file. This is not possible with > "linear" config files - without init_targets(), which leads to massive code > amount increase - every file has to have almost all the code necessary, > every file can be run by itself and it's not possible to prohibit that > behavior. > > Idea behind init_targets() is good, but config files should be changed to > adhere to this scheme. I cannot change them all, because I cannot test with > chips I don't have - I only use LPC2xxx and STM32 (I can change STMs). > > 4\/3!!
How does it look in tcl to override the init_targets from the lpc2478.cpu file in code? Does that function then also call the original init_targets to preserve its initial setup? If thats easy then why not move the stuff at the start of the ea board file into the board specific init_targets function, call the initial one after sourcing the lpc2478.cpu file and then continue with its use of $_TARGETNAME? Chris ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
