On 12 March 2014 16:15, Joerg Wunsch <[email protected]> wrote: > Hello, > > after getting a brand new "Atmel-ICE", I wanted to give it a try with > the CMSIS-DAP OpenOCD branch. >
What branch are you using as CMSIS-DAP has been merged into the master branch? Currently CMSIS-DAP it only uses SWD, a few more changes will be required to get JTAG access working. > I had to apply a couple of minor patches in order to work with it (see > Trac bugs #67 and #68), but can now operate it. > Thanks for the patches, we get no notifications from Trac so it can be slow in noticing any new bugs added. It is preferred to push the patches directly to gerrit - http://openocd.sourceforge.net/doc/doxygen/html/patchguide.html > However, I'm stumbling in getting the configuration entries to work > with a SAM3 device. > > Using a Segger J-Link on an Atmel SAM3S-EK works using these entries: > > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > adapter_khz 500 > source [find interface/jlink.cfg] > source [find board/atmel_sam3s_ek.cfg] > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > > If I now replace the interface entry by the CMSIS-DAP one: > > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > adapter_khz 500 > source [find interface/cmsis-dap.cfg] > source [find board/atmel_sam3s_ek.cfg] > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > > it fails with: > > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > Open On-Chip Debugger 0.8.0-dev-00381-gf91390f-dirty (2014-03-10-14:41) > Licensed under GNU GPL v2 > For bug reports, read > http://openocd.sourceforge.net/doc/doxygen/bugs.html > adapter speed: 500 kHz > Info : only one transport option; autoselect 'cmsis-dap' > Info : CMSIS-DAP: SWD Supported > Info : CMSIS-DAP: JTAG Supported > Info : CMSIS-DAP: Interface Initialised (SWD) > adapter speed: 500 kHz > adapter_nsrst_delay: 100 > Runtime Error: /usr/local/share/openocd/scripts/target/at91sam3XXX.cfg:49: > invalid command name "jtag_ntrst_delay" > in procedure 'script' > at file "embedded:startup.tcl", line 58 > at file "openocd.cfg", line 22 > at file "/usr/local/share/openocd/scripts/board/atmel_sam3s_ek.cfg", line 1 > at file "/usr/local/share/openocd/scripts/target/at91sam3sXX.cfg", line 13 > at file "/usr/local/share/openocd/scripts/target/at91sam3XXX.cfg", line 49 > Info : CMSIS-DAP: FW Version = 01.00.0021 > Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 0 nTRST = 0 nRESET = 1 > Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0) > Info : CMSIS-DAP: Interface ready > Info : clock speed 500 kHz > Error: BUG: current_target out of bounds > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > > Running it in GDB tells me that there is apparently no "target" set, > but why is that required at this point? > > However, if I pretend I were using a SAM4S-EK instead: > > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > adapter_khz 500 > source [find interface/cmsis-dap.cfg] > source [find board/atmel_sam4s_ek.cfg] > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > > it at least pretends to work, too (the IDCODE is wrong though, Segger > tells it must be 0x4ba00477): > As a guess I would say one is the jtag id and the other swd. > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > Open On-Chip Debugger 0.8.0-dev-00381-gf91390f-dirty (2014-03-10-14:41) > Licensed under GNU GPL v2 > For bug reports, read > http://openocd.sourceforge.net/doc/doxygen/bugs.html > adapter speed: 500 kHz > Info : only one transport option; autoselect 'cmsis-dap' > Info : CMSIS-DAP: SWD Supported > Info : CMSIS-DAP: JTAG Supported > Info : CMSIS-DAP: Interface Initialised (SWD) > adapter speed: 500 kHz > adapter_nsrst_delay: 100 > cortex_m reset_config sysresetreq > Info : CMSIS-DAP: FW Version = 01.00.0021 > Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 0 nTRST = 0 nRESET = 1 > Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0) > Info : CMSIS-DAP: Interface ready > Info : clock speed 500 kHz > Info : IDCODE 0x2ba01477 > Info : sam4.cpu: hardware has 6 breakpoints, 4 watchpoints > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- > > Hmm, so what's the difference? Both, SAM3 and SAM4 should be similar > enough, both support JTAG as well as SWD, so I think I should be able > to use the CMSIS-DAP debugger for them. > >From OpenOCD's point of view the core (m0/m3/m4) will be detected and handled internally, so the cfg will not change. The only difference in setup will be the flash driver used. > Comparing the board description files, I eventually get to the > following differences in the SAM3/4 target description files: > > +source [find target/swj-dp.tcl] > > -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id > $_CPUTAPID > +swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id > $_CPUTAPID > > Any clues are welcome. You have found the solution. It is a matter of including swj-dp.tcl and updating the cfg to comment out any jtag specific cmds, eg. if {$using_jtag} { jtag_ntrst_delay 100 } Cheers Spen ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
