The DigiX > DigiX Projects

Debug DUE/DigiX via JTAG

<< < (2/2)

dfarrell:
I have done it via the .gdbinit file but more recently I do it through code sourcery initialization features.  Yes the instructions get pushed through JTAG to configure the processor/registers prior to loading the program image via jtag.  In other projects I use this to initialize a DDR ram controller prior to loading for debug.  You may need to include a watchdog timer disable, since debug start up is slow.  In these scripts I also like to write a "key" value to a memory location, then in my code I look for this key and the code can tell if it is running in a debug session.

gogol:
Just as a follow-up my current configuration with the TCL-coded initialization:

openocd.cfg: with includes the JTAG interface and the BOARD

--- Code: ---source [find interface/FT232H.cfg]
source [find board/DUE-DigiX.cfg]

--- End code ---

FT232H.cfg:  which defines the settings for the UM232H-B, can be any other JTAG interface as well

--- Code: ---interface ftdi
ftdi_device_desc "UM232H-B"
ftdi_device_desc "C232HM-EDHSL-0"
ftdi_vid_pid 0x0403 0x6014
ftdi_layout_init 0x0018 0x05fb

--- End code ---

DUE-DigiX.cfg: defines the settings for the Arduino DUE or the DigiX and other clones

--- Code: ---##########################################################################
##   DigiX  and Arduino DUE compatible boards                           ##
##   Tested with DigiX, which has the JTAG pins broken out              ##
##   Discussion: http://digistump.com/board/index.php/topic,1275.0.html ##
##########################################################################

source [find target/at91sam3ax_8x.cfg]
source [find mem_helper.tcl]

proc enable_fast_clock {} {

      # Initialization taken from system_sam3xa.c: void SystemInit(void)
      #/* Set FWS according to SYS_BOARD_MCKR configuration */
      mww 0x400E0A00 0x400
      mww 0x400E0C00 0x400

      #/* Initialize main oscillator */
      if { [mrw 0x400E0620] & 0x1000000 == 0} {
        mww 0x400E0620 0x370809
        while {!{[mrw phys 0x400E0668] & 0x1}} {}
      }

      #/* Switch to 3-20MHz Xtal oscillator */
      mww 0x400E0620 0x370809
      while { [mrw 0x400E0668] & 0x10000 == 0} { }
      mww 0x400E0630 [expr [mrw 0x400E0630] & 0xFFFFFFFC | 0x1]
      while { [mrw 0x400E0668] & 0x8 == 0} { }

      #/* Initialize PLLA */
      mww 0x400E0628 0x200D3F01
      while { [mrw 0x400E0668] & 0x2 == 0} { }

      #/* Switch to main clock */
      mww 0x400E0630 0x11
      while { [mrw 0x400E0668] & 0x8 == 0} { }

      #/* Switch to PLLA */
      mww 0x400E0630 0x12
      while { [mrw 0x400E0668] & 0x8 == 0} { }

}


proc init_board {} {
    global _TARGETNAME

    $_TARGETNAME configure -event reset-start {
        # Back to the slow JTAG clock
        adapter_khz 5
    }

   $_TARGETNAME configure -event reset-init {
      adapter_khz 5
      enable_fast_clock
      adapter_khz 14000
   }
    $_TARGETNAME configure -event gdb-attach {
        reset init
    }
}

--- End code ---

helge:
Thank you for Due-DigiX.cfg. I've now spent an entire day trying to talk to a SAM3X8E via jtag, so allow me to ask this question:
is it possible to use the ti-icdi interface on TI launchpads to write to flash memory?


--- Code: ---telnet_port 4444

#interface 17: hla
source [find interface/ti-icdi.cfg]
hla_device_desc "TI Launchpad ICDI Interface"
transport select hla_jtag

set CHIPNAME at91sam3X8E
hla newtap $CHIPNAME cpu -expected-id 0

reset_config srst_only

source [find target/at91sam3ax_8x.cfg]
--- End code ---

all it does is throw error 0x4 and sometimes error 0x7, possibly because there is another problem with the way I try to use hla. Now I get the feeling that there's something seriously fishy here:


--- Quote ---adapter speed: 500 kHz
Info : This adapter doesn't support configurable speed
--- End quote ---

Does this mean that adapter_khz 5 is not possible and thus I'm out of luck with the current capabilities of ti-icdi?
Thanks in advance for any comments.

gogol:
Unfortunately I don't know the TI device.  That sounds like a question to the openOCD forum.

Navigation

[0] Message Index

[*] Previous page

Go to full version