This patch adds the variable "DEVICECLASSIS" to Stellaris.cfg. This allows
the calling script to provide an manual override for Stellaris devices that
do not report the correct device class. If the variable is not defined the
normal behavior of reading the register for the device class is followed.

This patch is needed for LM3S3x26 C3/C5 revisions and no doubt other Tempest
devices that have an errata reporting themselves as 0x03 instead of 0x04.

A simple openocd.cfg example of use is then:

source [find interface/olimex-jtag-tiny.cfg]

#This is a manual override for the errata in C3/C5 revisions of LM3S3N26
set DEVICECLASSIS 0x4

source [find target/stellaris.cfg]
diff --git a/tcl/target/stellaris.cfg b/tcl/target/stellaris.cfg
index d631498..dc67669 100644
--- a/tcl/target/stellaris.cfg
+++ b/tcl/target/stellaris.cfg
@@ -1,5 +1,17 @@
 # TI/Luminary Stellaris LM3S chip family
 
+# Some devices have errata in returning their device class.
+# DEVICECLASSIS is provided as a manual override
+# Manual setting of a device class of 0xff is not allowed
+
+global _DEVICECLASSIS
+
+if { [info exists DEVICECLASSIS ] } {
+   set _DEVICECLASSIS $DEVICECLASSIS
+} else {
+   set _DEVICECLASSIS 0xff
+}
+
 # Luminary chips support both JTAG and SWD transports.
 # Adapt based on what transport is active.
 source [find target/swj-dp.tcl]
@@ -74,9 +86,16 @@ $_TARGETNAME configure -event reset-start {
        #       /openocd-development/2008-August/003065.html
        #
 
-       set device_class [expr (([mrw 0x400fe000] >> 16) & 0xff)]
+       global _DEVICECLASSIS
+
+       if {$_DEVICECLASSIS != 0xff} {
+          set device_class $_DEVICECLASSIS
+       } else {
+          set device_class [expr (([mrw 0x400fe000] >> 16) & 0xff)]
+       }
+
        if {$device_class == 0 || $device_class == 1 || $device_class == 3} {
-               # Sandstorm, Fury and DustDevil are able to use NVIC SYSRESETREQ
+               # Sandstorm, Fury and DustDevil are able to use NVIC 
SYSRESETREQ sysresetreq
                cortex_m3 reset_config sysresetreq
        } else {
                # Tempest and newer default to using NVIC VECTRESET
@@ -89,3 +108,4 @@ $_TARGETNAME configure -event reset-start {
 # flash configuration ... autodetects sizes, autoprobed
 flash bank $_CHIPNAME.flash stellaris 0 0 0 0 $_TARGETNAME
 
+
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to