Hi Tomek,

I didn't realize there was a fork for SWD support, so my original attempt
was based on the master branch.  Nevertheless I cloned the fork that you
indicated and immediately ran into a number of compiler issues trying to
compile it on a Mac OS X platform.  The patch attachment covers most of the
changes necessary to address those problems.  These should be neutral for
other platforms, but you may want to make sure.

Additionally I had to make a minor change in the libswd submodule directory.
Unfortunately git seems to know that the submodule directory is dirty, but
indicates that content is untracked and is unable to do a diff.  I am not
sure what issue git has with submodules on my system without burning some
time studying its finer features.

Fortunately the change in the submodule directory is minor. I basically was
forced to add an "#include <stdint.h>" in the libswd.h file at line 90 after
stdlib.h.

The single change in the header plus those listed in the patch file allowed
me to successfully compile openocd from the fork on OS X.  But unfortunately
the problems did not end there.  After a successful build, running the tool
gets a little further then before, but still bombs out fairly quickly:

Jupiter:build garycarlson$ openocd -d3 -f jlink.cfg -f efm32.cfg
Open On-Chip Debugger 0.5.0-dev-g4e2a176-dirty (2011-08-20-20:18)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.berlios.de/doc/doxygen/bugs.html
User : 11 31 command.c:557 command_print(): debug_level: 3
Debug: 12 31 configuration.c:45 add_script_search_dir(): adding
/Users/garycarlson/.openocd
Debug: 13 31 configuration.c:45 add_script_search_dir(): adding
/usr/local/share/openocd/site
Debug: 14 31 configuration.c:45 add_script_search_dir(): adding
/usr/local/share/openocd/scripts
Debug: 15 31 configuration.c:87 find_file(): found jlink.cfg
Debug: 16 63 command.c:151 script_debug(): command - ocd_command ocd_command
type ocd_interface jlink
Debug: 17 64 command.c:151 script_debug(): command - interface ocd_interface
jlink
Debug: 19 64 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 20 64 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 21 64 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 22 64 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 23 65 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 24 66 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 25 66 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 26 67 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 27 67 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 28 67 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Debug: 29 67 command.c:364 register_command_handler(): registering
'ocd_jlink'...
Warn : 30 67 transport.c:137 allow_transports(): Transports added, now
select one.
Debug: 31 67 transport.c:139 allow_transports(): allowing transport 'jtag'
Debug: 32 67 transport.c:139 allow_transports(): allowing transport 'swd'
Debug: 33 67 configuration.c:87 find_file(): found efm32.cfg
Debug: 34 92 command.c:151 script_debug(): command - ocd_command ocd_command
type ocd_transport select swd
Debug: 35 92 command.c:151 script_debug(): command - ocd_transport
ocd_transport select swd
Debug: 36 92 swd.c:160 oocd_swd_transport_select(): entering function...
Info : 37 93 swd.c:175 oocd_swd_transport_select(): New SWD context
initialized at 0x100324740
Debug: 38 93 swd_libswd_drv_openocd.c:228 swd_log_level_inherit(): OpenOCD's
swd_log_level_inherit(swdctx=@0x100324740, loglevel=3)

Debug: 39 93 swd.c:183 oocd_swd_transport_select(): SWD Transport selection
complete...
Debug: 40 93 configuration.c:87 find_file(): found
/usr/local/share/openocd/scripts/target/swj-dp.tcl
Debug: 41 125 command.c:151 script_debug(): command - ocd_command
ocd_command type ocd_transport select
Debug: 42 125 command.c:151 script_debug(): command - ocd_transport
ocd_transport select
User : 43 125 command.c:679 command_run_line(): Runtime Error:
/usr/local/share/openocd/scripts/target/swj-dp.tcl:24: invalid command name
"swd"
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'swj_newdap' called at file "efm32.cfg", line 33
at file "/usr/local/share/openocd/scripts/target/swj-dp.tcl", line 24


So from this it appeared to me that the swd routine was not being
registered.  A debug statement that I added to the swd_constructor function
in transport/swd.c confirms this.  I started digging deeper and also noticed
that the target/adi_v5_swd.c file is commented out in the makefile so it is
not building either.

My original impression is that the transport code you created depends on
David Browning's work, but a number of functions are duplicated in both
files which makes me think my assumptions may be faulty.  For grins I
modified the makefile to build the adi_v5_swd.c just to see what would
happen and it breaks badly during compilation.

Are you sure you don't have any other patches that haven't been committed to
the current head?  Obviously you have this working for other devices, so I
am either missing something important or failing to see one or more details.

In any case it looks like you and several people have made some significant
progress on this front which is encouraging!

Gary




On 8/18/11 11:29 PM, "Tomek CEDRO" <tomek.ce...@gmail.com> wrote:

> On Fri, Aug 19, 2011 at 1:09 AM, Carlson Gary
> <gcarl...@carlson-minot.com> wrote:
>> (...)
>> Debug: 35 45 command.c:151 script_debug(): command - ocd_transport
>> ocd_transport select swd
>>    Error: 36 45 target.c:435 get_current_target(): BUG: current_target out
>> of bounds
> 
> Hello Gary, did you try the openocd-libswd fork or the master branch?
> The first can already communicate with target, I will work on target
> implementation in upcoming days, it would be nice to have some support
> :-)
> 
> [1] http://repo.or.cz/w/openocd/libswd.git
> 
> Best regards,
> Tomek


Attachment: patch.mac_os_x
Description: Binary data

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to