stlink: rename stlink cmd names

As part of the switch to using the hla for the stlink interface we rename
the cmds to a more generic name.

Update scripts to match new names.

Also add handlers for deprecated names.

Change-Id: I6f00743da746e3aa13ce06acfdc93c8049545e07
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/921
Tested-by: jenkins
This commit is contained in:
Spencer Oliver 2012-10-24 09:52:00 +01:00
parent 549d9bc72c
commit 6c467da586
8 changed files with 72 additions and 33 deletions

View File

@ -218,7 +218,7 @@ COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
return ERROR_OK;
}
COMMAND_HANDLER(hl_interface_handle_api_command)
COMMAND_HANDLER(stlink_interface_handle_api_command)
{
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
@ -235,28 +235,28 @@ COMMAND_HANDLER(hl_interface_handle_api_command)
static const struct command_registration hl_interface_command_handlers[] = {
{
.name = "stlink_device_desc",
.name = "hla_device_desc",
.handler = &hl_interface_handle_device_desc_command,
.mode = COMMAND_CONFIG,
.help = "set the a device description of the adapter",
.usage = "description_string",
},
{
.name = "stlink_serial",
.name = "hla_serial",
.handler = &hl_interface_handle_serial_command,
.mode = COMMAND_CONFIG,
.help = "set the serial number of the adapter",
.usage = "serial_string",
},
{
.name = "stlink_layout",
.name = "hla_layout",
.handler = &hl_interface_handle_layout_command,
.mode = COMMAND_CONFIG,
.help = "set the layout of the adapter",
.usage = "layout_name",
},
{
.name = "stlink_vid_pid",
.name = "hla_vid_pid",
.handler = &hl_interface_handle_vid_pid_command,
.mode = COMMAND_CONFIG,
.help = "the vendor and product ID of the adapter",
@ -264,7 +264,7 @@ static const struct command_registration hl_interface_command_handlers[] = {
},
{
.name = "stlink_api",
.handler = &hl_interface_handle_api_command,
.handler = &stlink_interface_handle_api_command,
.mode = COMMAND_CONFIG,
.help = "set the desired stlink api level",
.usage = "api version 1 or 2",
@ -273,7 +273,7 @@ static const struct command_registration hl_interface_command_handlers[] = {
};
struct jtag_interface hl_interface = {
.name = "stlink",
.name = "hla",
.supported = 0,
.commands = hl_interface_command_handlers,
.transports = hl_transports,

View File

@ -122,9 +122,9 @@ hl_transport_jtag_subcommand_handlers[] = {
static const struct command_registration stlink_transport_command_handlers[] = {
{
.name = "stlink",
.name = "hla",
.mode = COMMAND_ANY,
.help = "perform stlink actions",
.help = "perform hl adapter actions",
.usage = "",
.chain = hl_transport_stlink_subcommand_handlers,
},
@ -167,9 +167,9 @@ static int hl_transport_init(struct command_context *cmd_ctx)
/* get selected transport as enum */
tr = HL_TRANSPORT_UNKNOWN;
if (strcmp(transport->name, "stlink_swd") == 0)
if (strcmp(transport->name, "hla_swd") == 0)
tr = HL_TRANSPORT_SWD;
else if (strcmp(transport->name, "stlink_jtag") == 0)
else if (strcmp(transport->name, "hla_jtag") == 0)
tr = HL_TRANSPORT_JTAG;
else if (strcmp(transport->name, "stlink_swim") == 0)
tr = HL_TRANSPORT_SWIM;
@ -201,29 +201,29 @@ static int hl_transport_select(struct command_context *ctx)
}
static struct transport hl_swd_transport = {
.name = "stlink_swd",
.name = "hla_swd",
.select = hl_transport_select,
.init = hl_transport_init,
};
static struct transport hl_jtag_transport = {
.name = "stlink_jtag",
.name = "hla_jtag",
.select = hl_transport_select,
.init = hl_transport_init,
};
static struct transport hl_swim_transport = {
static struct transport stlink_swim_transport = {
.name = "stlink_swim",
.select = hl_transport_select,
.init = hl_transport_init,
};
const char *hl_transports[] = { "stlink_swd", "stlink_jtag", "stlink_swim", NULL };
const char *hl_transports[] = { "hla_swd", "hla_jtag", "stlink_swim", NULL };
static void hl_constructor(void) __attribute__ ((constructor));
static void hl_constructor(void)
{
transport_register(&hl_swd_transport);
transport_register(&hl_jtag_transport);
transport_register(&hl_swim_transport);
transport_register(&stlink_swim_transport);
}

View File

@ -106,4 +106,30 @@ proc jtag_nsrst_assert_width args {
eval adapter_nsrst_assert_width $args
}
# stlink migration helpers
proc stlink_device_desc args {
echo "DEPRECATED! use 'hla_device_desc' not 'stlink_device_desc'"
eval hla_device_desc $args
}
proc stlink_serial args {
echo "DEPRECATED! use 'hla_serial' not 'stlink_serial'"
eval hla_serial $args
}
proc stlink_layout args {
echo "DEPRECATED! use 'hla_layout' not 'stlink_layout'"
eval hla_layout $args
}
proc stlink_vid_pid args {
echo "DEPRECATED! use 'hla_vid_pid' not 'stlink_vid_pid'"
eval hla_vid_pid $args
}
proc stlink args {
echo "DEPRECATED! use 'hla' not 'stlink'"
eval hla $args
}
# END MIGRATION AIDS

View File

@ -771,8 +771,9 @@ static const struct command_registration adapter_command_handlers[] = {
COMMAND_REGISTRATION_DONE
};
struct target_type stm32_stlink_target = {
.name = "stm32_stlink",
struct target_type hla_target = {
.name = "hla_target",
.deprecated_name = "stm32_stlink",
.init_target = adapter_init_target,
.target_create = adapter_target_create,

View File

@ -87,7 +87,7 @@ extern struct target_type dsp563xx_target;
extern struct target_type dsp5680xx_target;
extern struct target_type testee_target;
extern struct target_type avr32_ap7k_target;
extern struct target_type stm32_stlink_target;
extern struct target_type hla_target;
static struct target_type *target_types[] = {
&arm7tdmi_target,
@ -110,7 +110,7 @@ static struct target_type *target_types[] = {
&dsp5680xx_target,
&testee_target,
&avr32_ap7k_target,
&stm32_stlink_target,
&hla_target,
NULL,
};

View File

@ -2,10 +2,10 @@
# STMicroelectronics ST-LINK/V1 in-circuit debugger/programmer
#
interface stlink
stlink_layout stlink
stlink_device_desc "ST-LINK/V1"
stlink_vid_pid 0x0483 0x3744
interface hla
hla_layout stlink
hla_device_desc "ST-LINK/V1"
hla_vid_pid 0x0483 0x3744
# unused but set to disable warnings
adapter_khz 1000

View File

@ -2,10 +2,10 @@
# STMicroelectronics ST-LINK/V2 in-circuit debugger/programmer
#
interface stlink
stlink_layout stlink
stlink_device_desc "ST-LINK/V2"
stlink_vid_pid 0x0483 0x3748
interface hla
hla_layout stlink
hla_device_desc "ST-LINK/V2"
hla_vid_pid 0x0483 0x3748
# unused but set to disable warnings
adapter_khz 1000

View File

@ -25,24 +25,36 @@ if { [info exists CPUTAPID] } {
if { [info exists TRANSPORT] } {
set _TRANSPORT $TRANSPORT
if { $TRANSPORT == "stlink_jtag" } {
if { $TRANSPORT == "hla_jtag" } {
if { [info exists CPUTAPID] == 0 } {
# jtag requires us to use the jtag tap id
set _CPUTAPID 0x3ba00477
}
}
} else {
set _TRANSPORT stlink_swd
set _TRANSPORT hla_swd
}
# add deprecated transport name check
if { $_TRANSPORT == "stlink_swd" } {
set _TRANSPORT "hla_swd"
echo "DEPRECATED! use 'hla_swd' transport not 'stlink_swd'"
}
if { $_TRANSPORT == "stlink_jtag" } {
set _TRANSPORT "hla_jtag"
echo "DEPRECATED! use 'hla_jtag' transport not 'stlink_jtag'"
}
# end deprecated checks
#
# possibles value are stlink_swd or stlink_jtag
# possibles value are hla_swd or hla_jtag
#
transport select $_TRANSPORT
stlink newtap $_CHIPNAME cpu -expected-id $_CPUTAPID
hla newtap $_CHIPNAME cpu -expected-id $_CPUTAPID
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME stm32_stlink -chain-position $_TARGETNAME
target create $_TARGETNAME hla_target -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0