This is an automated email from Gerrit. Antonio Borneo ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4877
-- gerrit commit fa112168bdbe2131009c2ec1a2256dae5abd44cc Author: Antonio Borneo <[email protected]> Date: Sun Jan 27 15:49:34 2019 +0100 hla_transport: split command registration per transport All the three HLA transports (hla_swd, hla_jtag and stlink_swim) register the same set of commands. Such commands are mainly aimed at handling JTAG compatibility that is required for the transport hla_jtag only. Split per transport the command registration and limit the commands to only those required by the transport itself. Replace the command "hla newtap" with a transport specific "swd newdap", "jtag newtap" or "swim newtap". Deprecate the command "hla". Modify accordingly the target's scripts. Change-Id: I79c78fa97b707482608516d3824151a4d07644c0 Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/jtag/hla/hla_transport.c b/src/jtag/hla/hla_transport.c index 3466462..f8cd6d0 100644 --- a/src/jtag/hla/hla_transport.c +++ b/src/jtag/hla/hla_transport.c @@ -46,6 +46,17 @@ COMMAND_HANDLER(hl_transport_reset_command) } static const struct command_registration +hl_swd_transport_subcommand_handlers[] = { + { + .name = "newdap", + .mode = COMMAND_CONFIG, + .jim_handler = jim_hl_newtap, + .help = "declare a new SWD DAP", + }, + COMMAND_REGISTRATION_DONE +}; + +static const struct command_registration hl_transport_stlink_subcommand_handlers[] = { { .name = "newtap", @@ -120,18 +131,22 @@ hl_transport_jtag_subcommand_handlers[] = { COMMAND_REGISTRATION_DONE }; -static const struct command_registration stlink_transport_command_handlers[] = { - +static const struct command_registration hl_swd_transport_command_handlers[] = { { - .name = "hla", + .name = "swd", .mode = COMMAND_ANY, - .help = "perform hl adapter actions", + .help = "SWD command group", .usage = "", - .chain = hl_transport_stlink_subcommand_handlers, + .chain = hl_swd_transport_subcommand_handlers, }, + COMMAND_REGISTRATION_DONE +}; + +static const struct command_registration hl_jtag_transport_command_handlers[] = { { .name = "jtag", .mode = COMMAND_ANY, + .help = "perform jtag tap actions", .usage = "", .chain = hl_transport_jtag_subcommand_handlers, }, @@ -144,11 +159,16 @@ static const struct command_registration stlink_transport_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -static int hl_transport_register_commands(struct command_context *cmd_ctx) -{ - return register_commands(cmd_ctx, NULL, - stlink_transport_command_handlers); -} +static const struct command_registration hl_swim_transport_command_handlers[] = { + { + .name = "swim", + .mode = COMMAND_ANY, + .help = "SWIM command group", + .usage = "", + .chain = hl_transport_stlink_subcommand_handlers, + }, + COMMAND_REGISTRATION_DONE +}; static int hl_transport_init(struct command_context *cmd_ctx) { @@ -189,41 +209,49 @@ static int hl_transport_init(struct command_context *cmd_ctx) return hl_interface_init_target(t); } -static int hl_transport_select(struct command_context *ctx) +static int hl_swd_transport_select(struct command_context *cmd_ctx) { - LOG_DEBUG("hl_transport_select"); - - int retval; + LOG_DEBUG("hl_swd_transport_select"); /* NOTE: interface init must already have been done. * That works with only C code ... no Tcl glue required. */ - retval = hl_transport_register_commands(ctx); + return register_commands(cmd_ctx, NULL, + hl_swd_transport_command_handlers); +} - if (retval != ERROR_OK) - return retval; +static int hl_jtag_transport_select(struct command_context *cmd_ctx) +{ + LOG_DEBUG("hl_jtag_transport_select"); + return register_commands(cmd_ctx, NULL, + hl_jtag_transport_command_handlers); +} - return ERROR_OK; +static int hl_swim_transport_select(struct command_context *cmd_ctx) +{ + LOG_DEBUG("hl_swim_transport_select"); + return register_commands(cmd_ctx, NULL, + hl_swim_transport_command_handlers); } static struct transport hl_swd_transport = { .name = "hla_swd", - .select = hl_transport_select, + .select = hl_swd_transport_select, .init = hl_transport_init, .override_target = hl_interface_override_target, }; static struct transport hl_jtag_transport = { .name = "hla_jtag", - .select = hl_transport_select, + .select = hl_jtag_transport_select, .init = hl_transport_init, .override_target = hl_interface_override_target, }; static struct transport stlink_swim_transport = { .name = "stlink_swim", - .select = hl_transport_select, + .select = hl_swim_transport_select, .init = hl_transport_init, }; diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl index d57cafb..caad6d6 100644 --- a/src/jtag/startup.tcl +++ b/src/jtag/startup.tcl @@ -160,4 +160,18 @@ proc stlink args { eval hla $args } +proc hla {{subcommand ""} args} { + if {$subcommand eq "newtap"} { + if {[ transport select ] eq "stlink_swim"} { + echo "DEPRECATED! use 'swim newtap' not 'hla newtap'" + eval swim newtap $args + } else { + echo "DEPRECATED! use 'swj_newdap' not 'hla newtap'" + eval swj_newdap $args + } + } else { + return -code error "Unknown command 'hla $subcommand $args'" + } +} + # END MIGRATION AIDS diff --git a/tcl/target/stm8l.cfg b/tcl/target/stm8l.cfg index 5cc99e1..1e15fda 100644 --- a/tcl/target/stm8l.cfg +++ b/tcl/target/stm8l.cfg @@ -62,7 +62,7 @@ if { [info exists BLOCKSIZE] } { set _BLOCKSIZE 0x80 } -hla newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0 +swim newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0 set _TARGETNAME $_CHIPNAME.cpu diff --git a/tcl/target/stm8s.cfg b/tcl/target/stm8s.cfg index d55e61b..747045f 100644 --- a/tcl/target/stm8s.cfg +++ b/tcl/target/stm8s.cfg @@ -62,7 +62,7 @@ if { [info exists BLOCKSIZE] } { set _BLOCKSIZE 0x80 } -hla newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0 +swim newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0 set _TARGETNAME $_CHIPNAME.cpu diff --git a/tcl/target/swj-dp.tcl b/tcl/target/swj-dp.tcl index 1d274cb..3fb0263 100644 --- a/tcl/target/swj-dp.tcl +++ b/tcl/target/swj-dp.tcl @@ -24,11 +24,12 @@ if [catch {transport select}] { } proc swj_newdap {chip tag args} { - if [using_hla] { - eval hla newtap $chip $tag $args - } elseif [using_jtag] { + if [using_jtag] { eval jtag newtap $chip $tag $args } elseif [using_swd] { eval swd newdap $chip $tag $args + } else { + echo "Error: transport '[ transport select ]' not supported by swj_newdap" + shutdown } } -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
