On Thu, Feb 2, 2012 at 11:30 AM, Freddie Chopin <[email protected]> wrote: > W dniu 2012-02-02 01:25, Chris Morgan pisze: > >> Saw your patch. I tried the same thing here but it doesn't work for >> the embedded artists target, the board I have here for testing >> openocd. >> >> The ea target includes the lpc2478.cpu file and then starts using >> _TARGETNAME. As I mentioned in my original email, because init hasn't >> been called yet the variable isn't valid and the ea script has an >> error. It's right at the top of the file if you want to see. >> >> The question is how target boards are supposed to work. It would be >> great if a dev could just say that the paradigm is x and we could >> march to that. Maybe the fix is to have the ea target setup another >> init like script whereby the one that calls through to the CPU file >> runs and then the target one runs so variables are setup in the >> correct order. But who knows? > > > The idea was that board scripts (anything that sources generic config files > from targets dir) should override init_targets with it's own version. If we > want to keep init_targets in lpc2xxx files and make current board script > working correctly, the only solution I see is to modify config files like > that: > > 1. Each config file (lpc2103.cfg, lpc2148.cfg, ...) has "set _TARGETNAME > ..." at top. > 2. This var is passed to setup_lpc2xxx() procedure > 3. setup_lpc2xxx() procedure does not set this variable, but uses what was > set previously > > There's either this or going further with init_targets() and introducing > that to board config files (or adding "init" before first line of code in > board config script). > > Therefore I still wonder whether keeping init_targets is a good idea - there > is absolutely zero adoption of this scheme - the only scripts that use this > idea are lpc2xxx ones that I've done when it was introduced (it was one year > ago) > > http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd;a=commit;h=94fa8fd30ae5fd29529f401e123864565591e2ed > > 4\/3!!
Ahh, so you followed the init_target scheme with your patch. Do you know who came up with the init_target idea? That's the person that would probably best help decide what to do. Maybe you are right and the lpcxxx.cpu scripts should be modified to call to the generic ones directly, removing the init_target usage, as you've suggested. Then when sourced the $_TARGETNAME would be valid. If there was an init_board then the actionable code in the ea board file could be placed into there and openocd could call init_target() and then init_board() and everything would work since the target would be initialized before use. 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
