|
From: OpenOCD-Gerrit <ope...@us...> - 2014-01-08 22:19:17
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 416e79e24a7baf0541955799297a00b76c1fe002 (commit)
via c8161b013c9d3c454365b31b129213572909ec33 (commit)
via 302a3a8fed6a279b99d64dd901946202bd6afa6f (commit)
via faedb1477292dda20267adbdcf6536da3ec77502 (commit)
via 436f66b46327296ce818c3265f09381b2b0af7a7 (commit)
from 58aecca7b331c203aa79d05987d1e7691cd1617b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 416e79e24a7baf0541955799297a00b76c1fe002
Author: Paul Fertser <fer...@gm...>
Date: Mon Dec 30 23:09:51 2013 +0400
tcl/netgear-dg834v3.cfg: add to easy firmware recovery list
Change-Id: I6e5205ec41c58dc2fe3fb0051c30918507ef1e88
Signed-off-by: Paul Fertser <fer...@gm...>
Reviewed-on: http://openocd.zylin.com/1851
Tested-by: jenkins
Reviewed-by: Spencer Oliver <sp...@sp...>
diff --git a/tcl/board/netgear-dg834v3.cfg b/tcl/board/netgear-dg834v3.cfg
index afa9823..48d23da 100644
--- a/tcl/board/netgear-dg834v3.cfg
+++ b/tcl/board/netgear-dg834v3.cfg
@@ -4,6 +4,12 @@
# Flash is located at 0x90000000 (CS0) and RAM is located at 0x94000000 (CS1)
#
+set partition_list {
+ loader { "Bootloader (ADAM2)" 0x90000000 0x00020000 }
+ firmware { "Kernel+rootfs" 0x90020000 0x003d0000 }
+ config { "Bootloader config space" 0x903f0000 0x00010000 }
+}
+
source [find target/ti-ar7.cfg]
# External 16MB SDRAM - disabled as we use internal sram
diff --git a/tcl/tools/firmware-recovery.tcl b/tcl/tools/firmware-recovery.tcl
index 718de0b..ee1a284 100644
--- a/tcl/tools/firmware-recovery.tcl
+++ b/tcl/tools/firmware-recovery.tcl
@@ -4,6 +4,7 @@ echo "Use -c firmware_help to get help\n"
set known_boards {
"asus-rt-n16 ASUS RT-N16"
"linksys-wrt54gl Linksys WRT54GL v1.1"
+ "netgear-dg834v3 Netgear DG834G v3"
}
proc firmware_help { } {
commit c8161b013c9d3c454365b31b129213572909ec33
Author: Paul Fertser <fer...@gm...>
Date: Mon Dec 30 22:33:43 2013 +0400
tools: add firmware recovery helpers
This adds a set of helper functions with the aim to make it possible
to flash mass-market devices without RTFMing altogether (i.e. to
obsolete GPL-violating proprietary tjtag and other similar software).
Real-life tested on an RT-N16 and WRT54GL.
Change-Id: I197a9b28a5f386803f081057c4b4ebf2f9c447b1
Signed-off-by: Paul Fertser <fer...@gm...>
Reviewed-on: http://openocd.zylin.com/1850
Tested-by: jenkins
Reviewed-by: Spencer Oliver <sp...@sp...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index d2a2259..59b5b7d 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -7973,6 +7973,17 @@ storage bit in the device is tested as zero and as one.
Run all of the above tests over a specified memory region.
@end deffn
+@section Firmware recovery helpers
+@cindex Firmware recovery
+
+OpenOCD includes an easy-to-use script to faciliate mass-market
+devices recovery with JTAG.
+
+For quickstart instructions run:
+@example
+openocd -f tools/firmware-recovery.tcl -c firmware_help
+@end example
+
@node TFTP
@chapter TFTP
@cindex TFTP
diff --git a/tcl/tools/firmware-recovery.tcl b/tcl/tools/firmware-recovery.tcl
new file mode 100644
index 0000000..718de0b
--- /dev/null
+++ b/tcl/tools/firmware-recovery.tcl
@@ -0,0 +1,108 @@
+echo "\n\nFirmware recovery helpers"
+echo "Use -c firmware_help to get help\n"
+
+set known_boards {
+ "asus-rt-n16 ASUS RT-N16"
+ "linksys-wrt54gl Linksys WRT54GL v1.1"
+}
+
+proc firmware_help { } {
+ echo "
+Your OpenOCD command should look like this:
+openocd -f interface/<jtag adapter>.cfg -f tools/firmware-recovery.tcl -c \"<commands>*; shutdown\"
+
+Where:
+<jtag adapter> is one of the supported devices, e.g. ftdi/jtagkey2
+<commands> are firmware-recovery commands separated by semicolon
+
+Supported commands:
+firmware_help get this help
+list_boards list known boards and exit
+board <name> select board you work with
+list_partitions list partitions of the currently selected board
+dump_part <name> <filename> save partition's contents to a file
+erase_part <name> erase the given partition
+flash_part <name> <filename> erase, flash and verify the given partition
+ram_boot <filename> load binary file to RAM and run it
+adapter_khz <freq> set JTAG clock frequency in kHz
+
+For example, to clear nvram and reflash CFE on an RT-N16 using TUMPA, run:
+openocd -f interface/ftdi/tumpa.cfg -f tools/firmware-recovery.tcl \\
+ -c \"board asus-rt-n16; erase_part nvram; flash_part CFE cfe-n16.bin; shutdown\"
+\n\n"
+ shutdown
+}
+
+# set default, can be overriden later
+adapter_khz 1000
+
+proc get_partition { name } {
+ global partition_list
+ dict get $partition_list $name
+}
+
+proc partition_desc { name } { lindex [get_partition $name] 0 }
+proc partition_start { name } { lindex [get_partition $name] 1 }
+proc partition_size { name } { lindex [get_partition $name] 2 }
+
+proc list_boards { } {
+ global known_boards
+ echo "List of the supported boards:\n"
+ echo "Board name\t\tDescription"
+ echo "-----------------------------------"
+ foreach i $known_boards {
+ echo $i
+ }
+ echo "\n\n"
+}
+
+proc board { name } {
+ script [find board/$name.cfg]
+}
+
+proc list_partitions { } {
+ global partition_list
+ set fstr "%-16s%-14s%-14s%s"
+ echo "\nThe currently selected board is known to have these partitions:\n"
+ echo [format $fstr Name Start Size Description]
+ echo "-------------------------------------------------------"
+ for {set i 0} {$i < [llength $partition_list]} {incr i 2} {
+ set key [lindex $partition_list $i]
+ echo [format $fstr $key [partition_start $key] [partition_size $key] [partition_desc $key]]
+ }
+ echo "\n\n"
+}
+
+# Magic to work with any targets, including semi-functional
+proc prepare_target { } {
+ init
+ catch {halt}
+ catch {reset init}
+ catch {halt}
+}
+
+proc dump_part { name filename } {
+ prepare_target
+ dump_image $filename [partition_start $name] [partition_size $name]
+}
+
+proc erase_part { name } {
+ prepare_target
+ flash erase_address [partition_start $name] [partition_size $name]
+}
+
+proc flash_part { name filename } {
+ prepare_target
+ flash write_image erase $filename [partition_start $name] bin
+ echo "Verifying:"
+ verify_image $filename [partition_start $name]
+}
+
+proc ram_boot { filename } {
+ global ram_boot_address
+ prepare_target
+ load_image $filename $ram_boot_address bin
+ resume $ram_boot_address
+}
+
+echo ""
commit 302a3a8fed6a279b99d64dd901946202bd6afa6f
Author: Paul Fertser <fer...@gm...>
Date: Tue Dec 31 19:07:47 2013 +0400
tcl/board: add Linksys WRT54GL v1.1 board config
Tested flashing a real v1.1 device.
Change-Id: Ie0d202b9fded8b92e731d93e0ef17be415a75fc8
Signed-off-by: Paul Fertser <fer...@gm...>
Reviewed-on: http://openocd.zylin.com/1852
Tested-by: jenkins
Reviewed-by: Spencer Oliver <sp...@sp...>
diff --git a/tcl/board/linksys-wrt54gl.cfg b/tcl/board/linksys-wrt54gl.cfg
new file mode 100644
index 0000000..ffe53ff
--- /dev/null
+++ b/tcl/board/linksys-wrt54gl.cfg
@@ -0,0 +1,15 @@
+#
+# Linksys WRT54GL v1.1
+#
+
+source [find target/bcm5352e.cfg]
+
+set partition_list {
+ CFE { Bootloader 0x1c000000 0x00040000 }
+ firmware { "Kernel+rootfs" 0x1c040000 0x003b0000 }
+ nvram { "Config space" 0x1c3f0000 0x00010000 }
+}
+
+# External 4MB NOR Flash (Intel TE28F320C3BD90 or similar)
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME cfi 0x1c000000 0x00400000 2 2 $_TARGETNAME
diff --git a/tcl/target/bcm5352e.cfg b/tcl/target/bcm5352e.cfg
new file mode 100644
index 0000000..3f0495a
--- /dev/null
+++ b/tcl/target/bcm5352e.cfg
@@ -0,0 +1,7 @@
+set _CHIPNAME bcm5352e
+set _CPUID 0x0535217f
+
+jtag newtap $_CHIPNAME cpu -irlen 8 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUID
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME mips_m4k -endian little -chain-position $_TARGETNAME
commit faedb1477292dda20267adbdcf6536da3ec77502
Author: Paul Fertser <fer...@gm...>
Date: Mon Dec 30 22:26:36 2013 +0400
tcl: add bcm47xx config and Asus RT-N16 board using it
This adds the bcm47xx config with the special undocumented trick to
put it into standard EJTAG mode from the mystic "LV mode".
The RAM setup is not done as it would require considerable efforts
without much practical gain.
The only issue I noticed so far is that "reset" doesn't actually reset
the chip.
Unfortunately, it's unclear how to make it work properly with SRST as
OpenOCD asserts it in MIPS-specific code so the device will enter LV
mode again but the LV tap is already disabled by that time, so it's
not possible to send the magic command again.
Anyway, this config is more than enough to "recover" any RT-N16
provided the hardware is not damaged.
Change-Id: I0894e339763e6d20d1c93341c597382b479d039b
Signed-off-by: Paul Fertser <fer...@gm...>
Reviewed-on: http://openocd.zylin.com/1849
Tested-by: jenkins
Reviewed-by: Spencer Oliver <sp...@sp...>
diff --git a/tcl/board/asus-rt-n16.cfg b/tcl/board/asus-rt-n16.cfg
new file mode 100644
index 0000000..78f111d
--- /dev/null
+++ b/tcl/board/asus-rt-n16.cfg
@@ -0,0 +1,15 @@
+#
+# http://wikidevi.com/wiki/ASUS_RT-N16
+#
+
+set partition_list {
+ CFE { Bootloader 0xbc000000 0x00040000 }
+ firmware { "Kernel+rootfs" 0xbc040000 0x01fa0000 }
+ nvram { "Config space" 0xbdfe0000 0x00020000 }
+}
+
+source [find target/bcm4718.cfg]
+
+# External 32MB NOR Flash (Macronix MX29GL256EHTI2I-90Q)
+set _FLASHNAME $_CHIPNAME.flash
+flash bank $_FLASHNAME cfi 0xbc000000 0x02000000 1 1 $_TARGETNAME x16_as_x8
diff --git a/tcl/target/bcm4718.cfg b/tcl/target/bcm4718.cfg
new file mode 100644
index 0000000..8193914
--- /dev/null
+++ b/tcl/target/bcm4718.cfg
@@ -0,0 +1,5 @@
+set _CHIPNAME bcm4718
+set _LVTAPID 0x1471617f
+set _CPUID 0x0008c17f
+
+source [find target/bcm47xx.cfg]
diff --git a/tcl/target/bcm47xx.cfg b/tcl/target/bcm47xx.cfg
new file mode 100644
index 0000000..0132bb8
--- /dev/null
+++ b/tcl/target/bcm47xx.cfg
@@ -0,0 +1,21 @@
+echo "Forcing reset_config to none to prevent OpenOCD from pulling SRST after the switch from LV is already performed"
+reset_config none
+
+jtag newtap $_CHIPNAME-lv tap -irlen 32 -ircapture 0x1 -irmask 0x1f -expected-id $_LVTAPID -expected-id $_CPUID
+jtag configure $_CHIPNAME-lv.tap -event setup "jtag tapenable $_CHIPNAME.cpu"
+jtag configure $_CHIPNAME-lv.tap -event tap-disable {}
+
+jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUID -disable
+jtag configure $_CHIPNAME.cpu -event tap-enable "switch_lv_to_ejtag"
+
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME mips_m4k -endian little -chain-position $_TARGETNAME
+
+proc switch_lv_to_ejtag {} {
+ global _CHIPNAME
+ poll 0
+ irscan $_CHIPNAME-lv.tap 0x143ff3a
+ drscan $_CHIPNAME-lv.tap 32 1
+ jtag tapdisable $_CHIPNAME-lv.tap
+ poll 1
+}
commit 436f66b46327296ce818c3265f09381b2b0af7a7
Author: Robert P. J. Day <rp...@cr...>
Date: Wed Jan 8 11:43:25 2014 -0500
Allow "tcl_port" to be run after config to simply display the port.
To be consistent with gdb_port and telnet_port, allow tcl_port
to be run to display the configured port number, while still
not allowing the user to change it after configuration.
Change-Id: Ibe6aedb3bd447f2985e42dd8246358481a047dd6
Signed-off-by: Robert P. J. Day <rp...@cr...>
Reviewed-on: http://openocd.zylin.com/1857
Tested-by: jenkins
Reviewed-by: Spencer Oliver <sp...@sp...>
diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c
index 91f9778..b62f1a3 100644
--- a/src/server/tcl_server.c
+++ b/src/server/tcl_server.c
@@ -176,7 +176,7 @@ static const struct command_registration tcl_command_handlers[] = {
{
.name = "tcl_port",
.handler = handle_tcl_port_command,
- .mode = COMMAND_CONFIG,
+ .mode = COMMAND_ANY,
.help = "Specify port on which to listen "
"for incoming Tcl syntax. "
"Read help on 'gdb_port'.",
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 11 ++++
src/server/tcl_server.c | 2 +-
tcl/board/asus-rt-n16.cfg | 15 +++++
tcl/board/linksys-wrt54gl.cfg | 15 +++++
tcl/board/netgear-dg834v3.cfg | 6 ++
tcl/target/bcm4718.cfg | 5 ++
tcl/target/bcm47xx.cfg | 21 ++++++++
tcl/target/bcm5352e.cfg | 7 +++
tcl/tools/firmware-recovery.tcl | 109 +++++++++++++++++++++++++++++++++++++++
9 files changed, 190 insertions(+), 1 deletions(-)
create mode 100644 tcl/board/asus-rt-n16.cfg
create mode 100644 tcl/board/linksys-wrt54gl.cfg
create mode 100644 tcl/target/bcm4718.cfg
create mode 100644 tcl/target/bcm47xx.cfg
create mode 100644 tcl/target/bcm5352e.cfg
create mode 100644 tcl/tools/firmware-recovery.tcl
hooks/post-receive
--
Main OpenOCD repository
|