From 4db24acb931304355f59560789c5d92b99fb2962 Mon Sep 17 00:00:00 2001 From: Freddie Chopin Date: Fri, 3 Feb 2012 20:37:45 +0100 Subject: Add init_board procedure executed after init_targets This adds init_board procedure that behaves exactly the same as init_targets - it can be overriden by "next level" scripts. This procedure is executed after init_targets, allowing common stuff (jtag chain, memory, flash, ...) to be configured in target script (via init_target) and leaving rest (like additional memory, reset configuration, reset-init handlers, ...) to be done in init_board. This makes init_targets scheme more complete and easier to use - current board scripts will not need new init_targets, because everything can be "packed" in init_boards. Moreover it solves the problem of variables being set in init_targets (executed after init), which were not accessible by "linear" scripts (parsed before init). All that has to be done is to enclose all code in board config file in init_board procedure. Change-Id: I0736b1ff9873a687966407d62b58ccf29a8e597b Signed-off-by: Freddie Chopin Reviewed-on: http://openocd.zylin.com/427 Reviewed-by: Chris Morgan Tested-by: jenkins Reviewed-by: Peter Stuge --- src/target/target.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/target/target.c') diff --git a/src/target/target.c b/src/target/target.c index 5b2117d..f8326ea 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1033,6 +1033,10 @@ COMMAND_HANDLER(handle_target_init_command) if (ERROR_OK != retval) return retval; + retval = command_run_line(CMD_CTX, "init_board"); + if (ERROR_OK != retval) + return retval; + LOG_DEBUG("Initializing targets..."); return target_init(CMD_CTX); } -- cgit v1.1