mirror of
https://github.com/linux-msm/openocd.git
synced 2026-02-25 13:15:07 -08:00
ipdbg: split ipdbg command into multiple commands
To simplify the ipdbg start/stop command and be able to add additional commands in the future, we introduce the concept of a hub which has to be created before a ipdbg server can be started. The hub was created on the fly in previous versions. Change-Id: I55f317542d01a7324990b2cacd496a41fa5ff875 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7979 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
committed by
Antonio Borneo
parent
1d076d6ce1
commit
7a77355a3e
@@ -12116,55 +12116,84 @@ waveform generator. These are synthesize-able hardware descriptions of
|
||||
logic circuits in addition to software for control, visualization and further analysis.
|
||||
In a session using JTAG for its transport protocol, OpenOCD supports the function
|
||||
of a JTAG-Host. The JTAG-Host is needed to connect the circuit over JTAG to the
|
||||
control-software. For more details see @url{http://ipdbg.org}.
|
||||
control-software. The JTAG-Hub is the circuit which transfers the data from JTAG to the
|
||||
different tools connected to the Hub. Hub implementations for most major FPGA vendors/families
|
||||
are provided. For more details see @url{http://ipdbg.org}.
|
||||
|
||||
@deffn {Command} {ipdbg} [@option{-start|-stop}] @option{-tap @var{tapname}} @option{-hub @var{ir_value} [@var{dr_length}]} [@option{-vir [@var{vir_value} [@var{length} [@var{instr_code}]]]}] [@option{-port @var{number}}] [@option{-tool @var{number}}]
|
||||
Starts or stops a IPDBG JTAG-Host server. Arguments can be specified in any order.
|
||||
@deffn {Command} {ipdbg create-hub} @var{hub_name} @option{-tap @var{tapname}} @option{-ir @var{ir_value} [@var{dr_length}]} [@option{-vir [@var{vir_value} [@var{length} [@var{instr_code}]]]}]
|
||||
@deffnx {Command} {ipdbg create-hub} @var{hub_name} @option{-pld @var{pld_name} [@var{user}]} [@option{-vir [@var{vir_value} [@var{length} [@var{instr_code}]]]}]
|
||||
Creates a IPDBG JTAG Hub. The created hub is later used to start, stop and configure IPDBG JTAG Host servers.
|
||||
The first argument @var{hub_name} is the name of the created hub. It can be used later as a reference.
|
||||
|
||||
The pld drivers are able to provide the tap and ir_value for the IPDBG JTAG-Host server. This will be used with the second variant with option @option{-pld}.
|
||||
|
||||
Command options:
|
||||
@itemize @bullet
|
||||
@item @option{-start|-stop} starts or stops a IPDBG JTAG-Host server (default: start).
|
||||
@item @var{hub_name} the name of the IPDBG hub.
|
||||
This name is also used to create the object's command, referred to here
|
||||
as @command{$hub_name}, and in other places where the Hub needs to be identified.
|
||||
|
||||
@item @option{-tap @var{tapname}} targeting the TAP @var{tapname}.
|
||||
@item @option{-hub @var{ir_value}} states that the JTAG hub is
|
||||
reachable with dr-scans while the JTAG instruction register has the value @var{ir_value}.
|
||||
@item @option{-port @var{number}} tcp port number where the JTAG-Host will listen. The default is 4242 which is used when the option is not given.
|
||||
@item @option{-tool @var{number}} number of the tool/feature. These corresponds to the ports "data_(up/down)_(0..6)" at the JtagHub. The default is 1 which is used when the option is not given.
|
||||
@item @option{-vir [@var{vir_value} [@var{length} [@var{instr_code}]]]} On some devices, the user data-register is reachable if there is a
|
||||
specific value in a second dr. This second dr is called vir (virtual ir). With this parameter given, the IPDBG satisfies this condition prior an
|
||||
|
||||
@item @option{-ir @var{ir_value}} states that the JTAG hub is
|
||||
reachable with dr-scans while the JTAG instruction register has the value @var{ir_value}. Also known as @verb{|USERx|} instructions.
|
||||
The optional @var{dr_length} is the length of the dr.
|
||||
Current JTAG-Hub implementation only supports dr_length=13, which is also the default value.
|
||||
|
||||
@item @option{-vir [@var{vir_value} [@var{length} [@var{instr_code}]]]} To support more Hubs than USER registers in a single FPGA it is possible to
|
||||
use a mechanism known as virtual-ir where the user data-register is reachable if there is a specific value in a second dr.
|
||||
This second dr is called vir (virtual ir). With this parameter given, the IPDBG satisfies this condition prior an
|
||||
access to the IPDBG-Hub. The value shifted into the vir is given by the first parameter @var{vir_value} (default: 0x11). The second
|
||||
parameter @var{length} is the length of the vir data register (default: 5). With the @var{instr_code} (default: 0x00e) parameter the ir value to
|
||||
shift data through vir can be configured.
|
||||
|
||||
@item @option{-pld @var{pld_name} [@var{user}]} The defined driver for the pld @var{pld_name} is used to get the tap and user instruction.
|
||||
The pld devices names can be shown by the command @command{pld devices}. With [@var{user}] one can select a different @verb{|USERx|}-Instruction.
|
||||
If the IPDBG JTAG-Hub is used without modification the default value of 1 which selects the first @verb{|USERx|} instruction is adequate.
|
||||
The @verb{|USERx|} instructions are vendor specific and don't change between families of the same vendor.
|
||||
So if there's a pld driver for your vendor it should work with your FPGA even when the driver is not compatible with your device for the remaining features.
|
||||
If your device/vendor is not supported you have to use the first variant.
|
||||
|
||||
@end itemize
|
||||
|
||||
@end deffn
|
||||
|
||||
@deffn {Command} {$hub_name ipdbg start} @option{-tool @var{number}} @option{-port @var{number}}
|
||||
Starts a IPDBG JTAG-Host server. The remaining arguments can be specified in any order.
|
||||
|
||||
Command options:
|
||||
@itemize @bullet
|
||||
@item @option{-port @var{number}} tcp port number where the JTAG-Host will listen. The default is 4242 which is used when the option is not given.
|
||||
@item @option{-tool @var{number}} number of the tool/feature. These corresponds to the ports "data_(up/down)_(0..6)" at the JtagHub. The default is 1 which is used when the option is not given.
|
||||
@end itemize
|
||||
@end deffn
|
||||
or
|
||||
@deffn {Command} {ipdbg} [@option{-start|-stop}] @option{-pld @var{name} [@var{user}]} [@option{-port @var{number}}] [@option{-tool @var{number}}]
|
||||
Also starts or stops a IPDBG JTAG-Host server. The pld drivers are able to provide the tap and hub/IR for the IPDBG JTAG-Host server.
|
||||
With the @option{-pld @var{name} [@var{user}]} the information from the pld-driver is used and the options @option{-tap} and @option{-hub} are not required.
|
||||
The defined driver for the pld @var{name} gets selected. (The pld devices names can be shown by the command @command{pld devices}).
|
||||
|
||||
The @verb{|USERx|} instructions are vendor specific and don't change between families of the same vendor.
|
||||
So if there's a pld driver for your vendor it should work with your FPGA even when the driver is not compatible with your device for the remaining features. If your device/vendor is not supported you have to use the previous command.
|
||||
|
||||
With [@var{user}] one can select a different @verb{|USERx|}-Instruction. If the IPDBG JTAG-Hub is used without modification the default value of 1 which selects the first @verb{|USERx|} instruction is adequate.
|
||||
|
||||
The remaining options are described in the previous command.
|
||||
@deffn {Command} {$hub_name ipdbg stop} @option{-tool @var{number}}
|
||||
Stops a IPDBG JTAG-Host server.
|
||||
Command options:
|
||||
@itemize @bullet
|
||||
@item @option{-tool @var{number}} number of the tool/feature. These corresponds to the ports "data_(up/down)_(0..6)" at the JtagHub. The default is 1 which is used when the option is not given.
|
||||
@end itemize
|
||||
@end deffn
|
||||
|
||||
Examples:
|
||||
@example
|
||||
ipdbg -start -tap xc6s.tap -hub 0x02 -port 4242 -tool 4
|
||||
ipdbg create-hub xc6s.ipdbghub -tap xc6s.tap -hub 0x02
|
||||
xc6s.ipdbghub ipdbg start -port 4242 -tool 4
|
||||
@end example
|
||||
Starts a server listening on tcp-port 4242 which connects to tool 4.
|
||||
Creates a IPDBG Hub and starts a server listening on tcp-port 4242 which connects to tool 4.
|
||||
The connection is through the TAP of a Xilinx Spartan 6 on USER1 instruction (tested with a papillion pro board).
|
||||
|
||||
@example
|
||||
ipdbg -start -tap 10m50.tap -hub 0x00C -vir -port 60000 -tool 1
|
||||
ipdbg create-hub max10m50.ipdbghub -tap max10m50.tap -hub 0x00C -vir
|
||||
max10m50.ipdbghub ipdbg start -tool 1 -port 60000
|
||||
@end example
|
||||
Starts a server listening on tcp-port 60000 which connects to tool 1 (data_up_1/data_down_1).
|
||||
The connection is through the TAP of a Intel MAX10 virtual jtag component (sld_instance_index is 0; sld_ir_width is smaller than 5).
|
||||
|
||||
@example
|
||||
ipdbg -start -pld xc7.pld -port 5555 -tool 0
|
||||
ipdbg create-hub xc7.ipdbghub -pld xc7.pld
|
||||
xc7.ipdbghub ipdbg start -port 5555 -tool 0
|
||||
@end example
|
||||
Starts a server listening on tcp-port 5555 which connects to tool 0 (data_up_0/data_down_0).
|
||||
The TAP and ir value used to reach the JTAG Hub is given by the pld driver.
|
||||
|
||||
@@ -1146,4 +1146,132 @@ proc "pld device" {driver tap_name {opt 0}} {
|
||||
}
|
||||
}
|
||||
|
||||
lappend _telnet_autocomplete_skip "ipdbg -start"
|
||||
proc "ipdbg -start" {args} {
|
||||
echo "DEPRECATED! use 'ipdbg create-hub' and 'chip.ipdbghub ipdbg start ...', not 'ipdbg -start ...'"
|
||||
set tap_name ""
|
||||
set pld_name ""
|
||||
set tool_num "1"
|
||||
set port_num "4242"
|
||||
set idx 0
|
||||
set num_args [llength $args]
|
||||
while {$idx < $num_args} {
|
||||
set arg [lindex $args $idx]
|
||||
switch -- $arg {
|
||||
"-tap" {
|
||||
incr idx
|
||||
if {$idx >= $num_args || [string index [lindex $args $idx] 0] == "-"} {
|
||||
echo "no TAP name given"
|
||||
return
|
||||
}
|
||||
set tap_name [lindex $args $idx]
|
||||
}
|
||||
"-pld" {
|
||||
incr idx
|
||||
if {$idx >= $num_args || [string index [lindex $args $idx] 0] == "-"} {
|
||||
echo "no PLD name given"
|
||||
return
|
||||
}
|
||||
set pld_name [lindex $args $idx]
|
||||
}
|
||||
"-tool" {
|
||||
if {[expr {$idx + 1}] < $num_args && [string index [lindex $args [expr {$idx + 1}]] 0] != "-"} {
|
||||
set tool_num [lindex $args [expr {$idx + 1}]]
|
||||
set args [lreplace $args [expr {$idx + 1}] [expr {$idx + 1}]]
|
||||
incr num_args -1
|
||||
}
|
||||
set args [lreplace $args $idx $idx]
|
||||
incr num_args -1
|
||||
incr idx -1
|
||||
}
|
||||
"-port" {
|
||||
if {[expr {$idx + 1}] < $num_args && [string index [lindex $args [expr {$idx + 1}]] 0] != "-"} {
|
||||
set port_num [lindex $args [expr {$idx + 1}]]
|
||||
set args [lreplace $args [expr {$idx + 1}] [expr {$idx + 1}]]
|
||||
incr num_args -1
|
||||
}
|
||||
set args [lreplace $args $idx $idx]
|
||||
incr num_args -1
|
||||
incr idx -1
|
||||
}
|
||||
"-hub" {
|
||||
set args [lreplace $args $idx $idx "-ir" ]
|
||||
}
|
||||
default {
|
||||
# don't touch remaining arguments
|
||||
}
|
||||
}
|
||||
incr idx
|
||||
}
|
||||
|
||||
set hub_name ""
|
||||
if {$tap_name != ""} {
|
||||
set hub_name [lindex [split $tap_name .] 0].ipdbghub
|
||||
} elseif {$pld_name != ""} {
|
||||
set hub_name [lindex [split $pld_name .] 0].ipdbghub
|
||||
} else {
|
||||
echo "parsing arguments failed: no tap and no pld given."
|
||||
return
|
||||
}
|
||||
|
||||
echo "name: $hub_name"
|
||||
echo "ipdbg create-hub $hub_name $args"
|
||||
|
||||
catch {eval ipdbg create-hub $hub_name $args}
|
||||
|
||||
eval $hub_name ipdbg start -tool $tool_num -port $port_num
|
||||
}
|
||||
|
||||
lappend _telnet_autocomplete_skip "ipdbg -stop"
|
||||
proc "ipdbg -stop" {args} {
|
||||
echo "DEPRECATED! use 'chip.ipdbghub ipdbg stop ...', not 'ipdbg -stop ...'"
|
||||
set tap_name ""
|
||||
set pld_name ""
|
||||
set tool_num "1"
|
||||
set idx 0
|
||||
set num_args [llength $args]
|
||||
while {$idx < $num_args} {
|
||||
set arg [lindex $args $idx]
|
||||
switch -- $arg {
|
||||
"-tap" {
|
||||
incr idx
|
||||
if {$idx >= $num_args || [string index [lindex $args $idx] 0] == "-"} {
|
||||
echo "no TAP name given"
|
||||
return
|
||||
}
|
||||
set tap_name [lindex $args $idx]
|
||||
}
|
||||
"-pld" {
|
||||
incr idx
|
||||
if {$idx >= $num_args || [string index [lindex $args $idx] 0] == "-"} {
|
||||
echo "no PLD name given"
|
||||
return
|
||||
}
|
||||
set pld_name [lindex $args $idx]
|
||||
}
|
||||
"-tool" {
|
||||
if {[expr {$idx + 1}] < $num_args && [string index [lindex $args [expr {$idx + 1}]] 0] != "-"} {
|
||||
set tool_num [lindex $args [expr {$idx + 1}]]
|
||||
}
|
||||
}
|
||||
default {
|
||||
# don't touch remaining arguments
|
||||
}
|
||||
}
|
||||
incr idx
|
||||
}
|
||||
|
||||
set hub_name ""
|
||||
if {$tap_name != ""} {
|
||||
set hub_name [lindex [split $tap_name .] 0].ipdbghub
|
||||
} elseif {$pld_name != ""} {
|
||||
set hub_name [lindex [split $pld_name .] 0].ipdbghub
|
||||
} else {
|
||||
echo "parsing arguments failed: no tap and no pld given."
|
||||
return
|
||||
}
|
||||
|
||||
eval $hub_name ipdbg stop -tool $tool_num
|
||||
}
|
||||
|
||||
# END MIGRATION AIDS
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,5 +7,6 @@
|
||||
#include <helper/command.h>
|
||||
|
||||
int ipdbg_register_commands(struct command_context *cmd_ctx);
|
||||
int ipdbg_server_free(void);
|
||||
|
||||
#endif /* OPENOCD_IPDBG_IPDBG_H */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "openocd.h"
|
||||
#include "tcl_server.h"
|
||||
#include "telnet_server.h"
|
||||
#include "ipdbg.h"
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
@@ -714,6 +715,7 @@ void server_free(void)
|
||||
tcl_service_free();
|
||||
telnet_service_free();
|
||||
jsp_service_free();
|
||||
ipdbg_server_free();
|
||||
|
||||
free(bindto_name);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ source [find fpga/altera-cycloneiii.cfg]
|
||||
#quartus_cpf --option=bitstream_compression=off -c output_files\cycloneiii_blinker.sof cycloneiii_blinker.rbf
|
||||
|
||||
#openocd -f board/bemicro_cycloneiii.cfg -c "init" -c "pld load cycloneiii.pld cycloneiii_blinker.rbf"
|
||||
# "ipdbg -start -tap cycloneiii.tap -hub 0x00e -tool 0 -port 5555"
|
||||
# "ipdbg create-hub cycloneiii.ipdbghub -tap cycloneiii.tap -ir 0x00e"
|
||||
# "cycloneiii.ipdbghub ipdbg start -tool 0 -port 5555"
|
||||
|
||||
|
||||
set JTAGSPI_CHAIN_ID cycloneiii.pld
|
||||
|
||||
@@ -15,7 +15,8 @@ adapter speed 10000
|
||||
|
||||
source [find cpld/xilinx-xc7.cfg]
|
||||
|
||||
# "ipdbg -start -tap xc7.tap -hub 0x02 -tool 0 -port 5555"
|
||||
# "ipdbg create-hub xc7.ipdbghub -tap xc7.tap -ir 0x02"
|
||||
# "xc7.ipdbghub ipdbg start -tool 0 -port 5555"
|
||||
#openocd -f board/digilent_cmod_s7.cfg -c "init" -c "pld load xc7.pld shared_folder/cmod_s7_fast.bit"
|
||||
|
||||
set JTAGSPI_CHAIN_ID xc7.pld
|
||||
|
||||
@@ -16,7 +16,8 @@ adapter speed 6000
|
||||
source [find fpga/lattice_ecp5.cfg]
|
||||
|
||||
#openocd -f board/ecp5_evaluation.cfg -c "init" -c "pld load ecp5.pld shared_folder/ecp5_blinker_impl1.bit"
|
||||
#ipdbg -start -tap ecp5.tap -hub 0x32 -port 5555 -tool 0
|
||||
#ipdbg create-hub ecp5.ipdbghub -tap ecp5.tap -ir 0x32
|
||||
#ecp5.ipdbghub ipdbg start -tool 0 -port 5555
|
||||
|
||||
set JTAGSPI_CHAIN_ID ecp5.pld
|
||||
source [find cpld/jtagspi.cfg]
|
||||
|
||||
@@ -16,4 +16,5 @@ source [find fpga/gowin_gw1n.cfg]
|
||||
|
||||
|
||||
#openocd -f board/gowin_runber.cfg -c "init" -c "pld load 0 impl/pnr/gw1n_blinker.fs"
|
||||
#ipdbg -start -tap gw1n.tap -hub 0x42 -port 5555 -tool 0
|
||||
#ipdbg create-hub gw1n.ipdbghub -tap gw1n.tap -ir 0x42
|
||||
#gw1n.ipdbghubipdbg start -tool 0 -port 5555
|
||||
|
||||
@@ -20,7 +20,8 @@ adapter speed 6000
|
||||
source [find fpga/efinix_trion.cfg]
|
||||
|
||||
#openocd -f board/trion_t20_bga256.cfg -c "init" -c "pld load trion.pld outflow/trion_blinker.bit"
|
||||
#ipdbg -start -tap trion.tap -hub 0x8 -port 5555 -tool 0
|
||||
#ipdbg create-hub trion.ipdbghub -tap trion.tap -ir 0x8
|
||||
#trion.ipdbghub ipdbg start -tool 0 -port 5555
|
||||
|
||||
set JTAGSPI_CHAIN_ID trion.pld
|
||||
source [find cpld/jtagspi.cfg]
|
||||
|
||||
Reference in New Issue
Block a user