<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://elinux.org/index.php?title=Amdm37x.cfg&amp;feed=atom&amp;action=history</id>
		<title>Amdm37x.cfg - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://elinux.org/index.php?title=Amdm37x.cfg&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Amdm37x.cfg&amp;action=history"/>
		<updated>2013-05-23T10:12:42Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=Amdm37x.cfg&amp;diff=127712&amp;oldid=prev</id>
		<title>Wmat: target config</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=Amdm37x.cfg&amp;diff=127712&amp;oldid=prev"/>
				<updated>2012-05-08T18:24:55Z</updated>
		
		<summary type="html">&lt;p&gt;target config&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight code=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# Copyright (C)   2010-2011   by Karl Kurbjun&lt;br /&gt;
# Copyright (C)   2009-2011   by Øyvind Harboe&lt;br /&gt;
# Copyright (C)   2009        by David Brownell&lt;br /&gt;
# Copyright (C)   2009        by Magnus Lundin&lt;br /&gt;
#&lt;br /&gt;
# TI AM/DM37x&lt;br /&gt;
#  http://www.ti.com/litv/pdf/sprugn4b&lt;br /&gt;
#&lt;br /&gt;
# This script is based on the AM3517 initialization.  It should be considered&lt;br /&gt;
# preliminary since it needs more complete testing and only the basic&lt;br /&gt;
# operations work.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
###############################################################################&lt;br /&gt;
# User modifiable parameters&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
# This script uses the variable CHIPTYPE to determine whether this is an AM35x&lt;br /&gt;
# or DM37x target. If CHIPTYPE is not set it will error out.&lt;br /&gt;
if { [info exists CHIPTYPE] } {&lt;br /&gt;
&lt;br /&gt;
   if { [info exists CHIPNAME] } {&lt;br /&gt;
      set _CHIPNAME $CHIPNAME&lt;br /&gt;
   } else {&lt;br /&gt;
      set _CHIPNAME $CHIPTYPE&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   switch $CHIPTYPE {&lt;br /&gt;
      dm37x {&lt;br /&gt;
         # Primary TAP: ICEpick-C (JTAG route controller) and boundary scan&lt;br /&gt;
         set _JRC_TAPID &amp;quot;-expected-id 0x2b89102f -expected-id 0x1b89102f -expected-id 0x0b89102f&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      am35x {&lt;br /&gt;
         # Primary TAP: ICEpick-C (JTAG route controller) and boundary scan&lt;br /&gt;
         set _JRC_TAPID &amp;quot;-expected-id 0x0b7ae02f&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      default {&lt;br /&gt;
         error &amp;quot;ERROR: CHIPTYPE was set, but it was not set to a valid value.  Acceptable values are \&amp;quot;dm37x\&amp;quot; or \&amp;quot;am35x\&amp;quot;.&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
} else {&lt;br /&gt;
  error &amp;quot;ERROR: CHIPTYPE was not defined. Please set CHIPTYPE to \&amp;quot;am35x\&amp;quot; for the AM35x or \&amp;quot;dm37x\&amp;quot; for the DM37x series in the board configuration.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Run the adapter at the fastest acceptable speed with the slowest possible&lt;br /&gt;
# core clock.&lt;br /&gt;
adapter_khz 10&lt;br /&gt;
&lt;br /&gt;
###############################################################################&lt;br /&gt;
# JTAG setup&lt;br /&gt;
# The OpenOCD commands are described in the TAP Declaration section&lt;br /&gt;
#  http://openocd.berlios.de/doc/html/TAP-Declaration.html&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
# The AM/DM37x has an ICEpick module in it like many of TI's other devices. More&lt;br /&gt;
#  can be read about this module in sprugn4b under chapter 27:  &amp;quot;Debug and&lt;br /&gt;
#  Emulation&amp;quot;.  The module is used to route the JTAG chain to the various&lt;br /&gt;
#  subsystems in the chip.&lt;br /&gt;
source [find target/icepick.cfg]&lt;br /&gt;
&lt;br /&gt;
# The TAP order should be described from the TDO connection in OpenOCD to the&lt;br /&gt;
#  TDI pin.  The OpenOCD FAQ describes this in more detail:&lt;br /&gt;
#  http://openocd.berlios.de/doc/html/FAQ.html&lt;br /&gt;
&lt;br /&gt;
# From SPRUGN4B CH27 the available secondary TAPs are in this order from TDO:&lt;br /&gt;
#&lt;br /&gt;
#  Device   |  TAP number&lt;br /&gt;
#  ---------|------------&lt;br /&gt;
#  DAP      |  3&lt;br /&gt;
#  Sequencer|  2   Note: The sequencer is an ARM968&lt;br /&gt;
#  DSP      |  1&lt;br /&gt;
#  D2D      |  0&lt;br /&gt;
#&lt;br /&gt;
# Right now the only secondary tap enabled is the DAP so the rest are left&lt;br /&gt;
# undescribed.&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
# Start of Chain Description&lt;br /&gt;
# The Secondary TAPs all have enable functions defined for use with the ICEpick&lt;br /&gt;
# Only the DAP is enabled.  The AM37xx does not have the Sequencer or DSP but&lt;br /&gt;
# the TAP numbers for ICEpick do not change.&lt;br /&gt;
#&lt;br /&gt;
# TODO: A disable function should also be added.&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
# Secondary TAP: DAP is closest to the TDO output&lt;br /&gt;
# The TAP enable event also needs to be described&lt;br /&gt;
jtag newtap $_CHIPNAME dap -irlen 4 -ircapture 0x1 -irmask 0xf -disable&lt;br /&gt;
jtag configure $_CHIPNAME.dap -event tap-enable \&lt;br /&gt;
   &amp;quot;icepick_c_tapenable $_CHIPNAME.jrc 3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# These taps are only present in the DM37x series.&lt;br /&gt;
if { $CHIPTYPE == &amp;quot;dm37x&amp;quot; } {&lt;br /&gt;
   # Secondary TAP: Sequencer (ARM968) it is not in the chain by default&lt;br /&gt;
   # The ICEpick can be used to enable it in the chain.&lt;br /&gt;
   jtag newtap $_CHIPNAME arm2 -irlen 4 -ircapture 0x1 -irmask 0x0f -disable&lt;br /&gt;
   jtag configure $_CHIPNAME.arm2 -event tap-enable \&lt;br /&gt;
      &amp;quot;icepick_c_tapenable $_CHIPNAME.jrc 2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Secondary TAP: C64x+ DSP - it is not in the chain by default (-disable)&lt;br /&gt;
   # The ICEpick can be used to enable it in the chain.&lt;br /&gt;
   jtag newtap $_CHIPNAME dsp -irlen 38 -ircapture 0x25 -irmask 0x3f -disable&lt;br /&gt;
   jtag configure $_CHIPNAME.dsp -event tap-enable \&lt;br /&gt;
      &amp;quot;icepick_c_tapenable $_CHIPNAME.jrc 1&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Secondary TAP: D2D it is not in the chain by default (-disable)&lt;br /&gt;
# The ICEpick can be used to enable it in the chain.&lt;br /&gt;
# This IRLEN is probably incorrect - not sure where the documentation is.&lt;br /&gt;
jtag newtap $_CHIPNAME d2d -irlen 4 -ircapture 0x1 -irmask 0x0f -disable&lt;br /&gt;
jtag configure $_CHIPNAME.d2d -event tap-enable \&lt;br /&gt;
   &amp;quot;icepick_c_tapenable $_CHIPNAME.jrc 0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Primary TAP: ICEpick - it is closest to TDI so last in the chain&lt;br /&gt;
eval &amp;quot;jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f $_JRC_TAPID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
# End of Chain Description&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
# Start JTAG TAP events&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
# some TCK tycles are required to activate the DEBUG power domain&lt;br /&gt;
jtag configure $_CHIPNAME.jrc -event post-reset &amp;quot;runtest 100&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Enable the DAP TAP&lt;br /&gt;
jtag configure $_CHIPNAME.jrc -event setup &amp;quot;jtag tapenable $_CHIPNAME.dap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
# End JTAG TAP events&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
###############################################################################&lt;br /&gt;
# Target Setup:&lt;br /&gt;
# This section is described in the OpenOCD documentation under CPU Configuration&lt;br /&gt;
#  http://openocd.berlios.de/doc/html/CPU-Configuration.html&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
# Create the CPU target to be used with GDB:  Cortex-A8, using DAP&lt;br /&gt;
set _TARGETNAME $_CHIPNAME.cpu&lt;br /&gt;
target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap&lt;br /&gt;
&lt;br /&gt;
# The DM37x has 64K of SRAM starting at address 0x4020_0000.  Allow the first&lt;br /&gt;
# 16K to be used as a scratchpad for OpenOCD.&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -work-area-phys 0x40200000 -work-area-size 0x4000&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
# Start Target Reset Event Setup:&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
# Set the JTAG clock down to 10 kHz to be sure that it will work with the&lt;br /&gt;
#  slowest possible core clock (16.8MHz/2 = 8.4MHz). It is OK to speed up&lt;br /&gt;
#  *after* PLL and clock tree setup.&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -event &amp;quot;reset-start&amp;quot; { adapter_khz 10 }&lt;br /&gt;
&lt;br /&gt;
# Describe the reset assert process for openocd - this is asserted with the&lt;br /&gt;
# ICEPick&lt;br /&gt;
$_TARGETNAME configure -event &amp;quot;reset-assert&amp;quot; {&lt;br /&gt;
&lt;br /&gt;
   global _CHIPNAME&lt;br /&gt;
&lt;br /&gt;
   # assert warm system reset through ICEPick&lt;br /&gt;
   icepick_c_wreset $_CHIPNAME.jrc&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# After the reset is asserted we need to re-initialize debugging and speed up&lt;br /&gt;
# the JTAG clock.&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -event reset-assert-post {&lt;br /&gt;
&lt;br /&gt;
   global _TARGETNAME&lt;br /&gt;
   amdm37x_dbginit $_TARGETNAME&lt;br /&gt;
   adapter_khz 1000&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -event gdb-attach {&lt;br /&gt;
&lt;br /&gt;
   global _TARGETNAME&lt;br /&gt;
   amdm37x_dbginit $_TARGETNAME&lt;br /&gt;
&lt;br /&gt;
   echo &amp;quot;Halting target&amp;quot;&lt;br /&gt;
   halt&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
# End Target Reset Event Setup:&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
###############################################################################&lt;br /&gt;
# Target Functions&lt;br /&gt;
# Add any functions needed for the target here&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
# Run this to enable invasive debugging.  This is run automatically in the&lt;br /&gt;
# reset sequence.&lt;br /&gt;
proc amdm37x_dbginit {target} {&lt;br /&gt;
   # General Cortex A8 debug initialisation&lt;br /&gt;
   cortex_a8 dbginit&lt;br /&gt;
&lt;br /&gt;
   # Enable DBGEN signal.  This signal is described in the ARM v7 TRM, but&lt;br /&gt;
   # access to the signal appears to be implementation specific.  TI does not&lt;br /&gt;
   # describe this register much except a quick line that states DBGEM (sic) is&lt;br /&gt;
   # at this address and this bit.&lt;br /&gt;
   $target mww phys 0x5401d030 0x00002000&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:OpenOCD]]&lt;br /&gt;
[[Category:Debugging]]&lt;/div&gt;</summary>
		<author><name>Wmat</name></author>	</entry>

	</feed>