aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPerry Hung <iperry@gmail.com>2011-05-26 20:21:36 -0400
committerPerry Hung <iperry@gmail.com>2011-05-26 20:44:47 -0400
commit2bd55903033d1ff8b3dc5082c80c18c877460bc3 (patch)
tree8ea9a4cc6030e422ed7138ed6159b1fee4b59967
parentd9f2a93159df96eef0d8084b96df7268533177ff (diff)
downloadlibrambutan-2bd55903033d1ff8b3dc5082c80c18c877460bc3.tar.gz
librambutan-2bd55903033d1ff8b3dc5082c80c18c877460bc3.zip
openocd: Fix repeated JTAG flash failure, use alternate reset config
1) Reset, halt, and unprotect the the flash before writing to it. This fixes a bug in which every other flash attempt would fail. 2) Maple R5 and below have NRST and JTNRST erroneously tied together, resulting in a full TAP and system reset when a reset is asserted. This prevents the 'reset halt' command from working. This can be fixed hard-hack style by cutting the trace out of JTNRST. Users of the Leaf Maple JTAG adapter will also need to cut the trace between TRST and SRST. 3) Assuming you have a functioning 'reset halt' setup (see 2), the 'make debug' command now halts the chip and waits for a gdb connection before proceeding execution.
-rw-r--r--support/openocd/debug_0.4.cfg6
-rw-r--r--support/openocd/flash_0.4.cfg14
2 files changed, 13 insertions, 7 deletions
diff --git a/support/openocd/debug_0.4.cfg b/support/openocd/debug_0.4.cfg
index bbc8864..7d6982a 100644
--- a/support/openocd/debug_0.4.cfg
+++ b/support/openocd/debug_0.4.cfg
@@ -24,7 +24,7 @@ jtag_nsrst_delay 100
jtag_ntrst_delay 100
#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
+reset_config srst_only
#jtag scan chain
if { [info exists CPUTAPID ] } {
@@ -67,8 +67,8 @@ $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-s
flash bank bank0 stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
proc nopforever {} {
- puts "Resetting the chip..."
- reset run
+ puts "Resetting the chip... Halting for debugger."
+ reset halt
}
init
diff --git a/support/openocd/flash_0.4.cfg b/support/openocd/flash_0.4.cfg
index e66d28d..32c06c6 100644
--- a/support/openocd/flash_0.4.cfg
+++ b/support/openocd/flash_0.4.cfg
@@ -24,7 +24,7 @@ jtag_nsrst_delay 100
jtag_ntrst_delay 100
#use combined on interfaces or targets that can't set TRST/SRST separately
-reset_config trst_and_srst
+reset_config srst_only
#jtag scan chain
if { [info exists CPUTAPID ] } {
@@ -70,17 +70,23 @@ flash bank bank0 stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
proc flash_chip {} {
echo "Halting..."
- halt
+ reset halt
+
+ echo "Unlocking flash..."
+ flash protect 0 0 last off
+
echo "Erasing..."
flash erase_address 0x08000000 0x20000
- # TODO: native
- #flash erase_address 0x08000000 0x80000
+
echo "Flashing image..."
flash write_bank 0 build/maple.bin 0
+
echo "Verifying image..."
verify_image build/maple.bin 0x08000000 bin
+
echo "Checksum verified, resetting chip"
reset run
+
echo "Daemon shutdown"
shutdown
}