]> git.sur5r.net Git - openocd/log
openocd
11 years agohla: cleanup read/write api
Spencer Oliver [Wed, 11 Sep 2013 20:31:50 +0000 (21:31 +0100)]
hla: cleanup read/write api

This is the first part in moving the adapter specific api back into the
driver.

The next task is to also move the hla read/write buffer size handling.

Change-Id: I86a19144b50b6de18659bfcd05b3729b2cafc051
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1621
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoREADME.Windows: MinGW-w64 is known to work for building, regular MinGW is quirky
Paul Fertser [Thu, 19 Sep 2013 15:21:35 +0000 (19:21 +0400)]
README.Windows: MinGW-w64 is known to work for building, regular MinGW is quirky

The regular MinGW doesn't work properly because it doesn't try to
provide C99 compatibility currently.

Change-Id: I27c1b9e1496a8c32032fab08a29cbe1124316edd
Reported-by: Tomáš Voda <Voda.Tomas@seznam.cz>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1638
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoarmv7m: add gdb target description support
Spencer Oliver [Fri, 13 Sep 2013 08:44:36 +0000 (09:44 +0100)]
armv7m: add gdb target description support

Change-Id: I7c01109c0b85d208fb04a7ae1185fab4b2ab96b8
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1620
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agogdb: cleanup gdb target description support
Spencer Oliver [Thu, 12 Sep 2013 13:49:19 +0000 (14:49 +0100)]
gdb: cleanup gdb target description support

Make sure we free any memory used for gdb_save_tdesc.

Change-Id: Ia226f6134318c8c6b0ac4fa20fe70a570a08d80d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1619
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agogdb: enable target description support by default
Spencer Oliver [Fri, 13 Sep 2013 08:34:01 +0000 (09:34 +0100)]
gdb: enable target description support by default

This enables gdb target description support by default, it will check that
this is supported by the active target.

Change-Id: Iea5a5b94c5e373af30dacb780020b79536caa1e3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1618
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoarmv7m: remove gdb register hacks
Spencer Oliver [Wed, 11 Sep 2013 11:33:32 +0000 (12:33 +0100)]
armv7m: remove gdb register hacks

Now that we support the target description format we do not need
these hacks anymore, we can now tell gdb what registers we support.

Change-Id: Ie774231d296420b35efcf708bc4435475c87ff5e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1617
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agogdb: add default description reg types
Spencer Oliver [Thu, 12 Sep 2013 11:31:49 +0000 (12:31 +0100)]
gdb: add default description reg types

Add support for the default gdb register description type "int" and "float".
When this is given to gdb it will use the bitsize to determine the reg size.

Change-Id: Iaeed594d1feece54044128eae1baff9858bdcae0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1622
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoRestore mwh/mwb functionality.
Andreas Fritiofson [Tue, 17 Sep 2013 20:09:22 +0000 (22:09 +0200)]
Restore mwh/mwb functionality.

Half-word and byte writes using mwh/mwb has been completely broken since
bf71e34cbf, because it dispatched all writes, regardless of access size,
to target_write_buffer(), which uses as large accesses as possible.

Partially revert the commit by changing back to the correct write method.

Change-Id: I60731fc576bf4a076a7da02bee7879e121c21d17
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1628
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoadiv5: check packed transfers are supported
Spencer Oliver [Wed, 18 Sep 2013 21:41:54 +0000 (22:41 +0100)]
adiv5: check packed transfers are supported

Currently we try and use MEM-AP packed transfers as much as possible for
8/16bit transfers. However not all targets support packed transfers, so
check before using.

Change-Id: I66256007f25ccd0c583f23db5acf6d1aa8b5e57d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1602
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoREADME.Windows: pkgconfig-lite should go into MinGW, not MSYS
Paul Fertser [Wed, 18 Sep 2013 09:48:21 +0000 (13:48 +0400)]
README.Windows: pkgconfig-lite should go into MinGW, not MSYS

As autoconf is part of MinGW, it uses its root to find m4 files, pkg-config
should be installed accordingly.

Change-Id: I551797e61a3d044f751768bd7d57d8e26e7202cc
Reported-by: Tomáš Voda <Voda.Tomas@seznam.cz>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1630
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoREADME: add missing adapters and flash drivers, mention profiling
Paul Fertser [Sun, 15 Sep 2013 14:33:07 +0000 (18:33 +0400)]
README: add missing adapters and flash drivers, mention profiling

This updates README with all the "keywords" added since the initial
upstream submission (and finally fixes the typo in the beginning).

Change-Id: Ia071267246fe6afc19fc0bfcda83c4778e7ff5b1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1624
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoconfigure: expand library search for libftd2xx
Stephan Linz [Fri, 6 Sep 2013 13:03:54 +0000 (15:03 +0200)]
configure: expand library search for libftd2xx

Error was:
checking for library containing FT_GetLibraryVersion... no
configure: error: You appear to be missing the FTD2xx driver library.

Reason were two cases:

Case one:
The FTD2xx library uses clock_gettime() and in normal cases
the linker will find the function in the libc library. Most
(older) systems require the program be linked with the librt
library to use these (see man clock_gettime: Link with -lrt).

Case two:
You can rebuild the FTD2xx library (relink from the object
files) against the primary (system wide installed) libusb-1.0.
So you avoid mixed code (GPL with proprietary code) in the
FTD2xx library. In this case, the FTD2xx library provides no
private (linked in) libusb-1.0 functionality and require the
program be linked with the libftd2xx __AND__ the libusb-1.0
to resolve all the libusb-1.0 symbols.

Change-Id: Iaf9a35ab4257e37b98dccd47667378ad2a64b7ed
Signed-off-by: Stephan Linz <linz@li-pro.net>
Reviewed-on: http://openocd.zylin.com/1614
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
11 years agocontrib: Add example cross-build script
Andreas Fritiofson [Fri, 13 Sep 2013 21:38:30 +0000 (23:38 +0200)]
contrib: Add example cross-build script

Usage:
export LIBUSB1_SRC=/path/to/libusb-1.0
export OPENOCD_CONFIG="--enable-..."
cd /work/dir
/path/to/openocd/contrib/cross-build.sh <host-triplet>

For static linking, a workaround is to
export LIBUSB1_CONFIG="--enable-static --disable-shared"

All the paths must not contain any spaces.

Feel free to comment or update this patchset with improvements.

Change-Id: Ib3b4970117f13a6140a1eddc493d324a52364519
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1531
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoconfigure: Add libusb-1.0 header bug workaround
Andreas Fritiofson [Thu, 1 Aug 2013 17:07:09 +0000 (19:07 +0200)]
configure: Add libusb-1.0 header bug workaround

Force the libusb-1.0 include dir to be treated as a system include path
which suppresses the cast-align warnings otherwise failing the build on
some platforms.

Change-Id: I738cfd793052b8772731d2feeef968ee893bd4bd
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1534
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoconfigure: auto-enable USB adapters based on libusb availability
Paul Fertser [Wed, 11 Sep 2013 21:25:19 +0000 (23:25 +0200)]
configure: auto-enable USB adapters based on libusb availability

This unifies the way the USB adapters are handled, and enables them
automatically whenever possible (until explicitly disabled). If an
adapter is explicitly enabled but can't be built, abort the
configure.

Also add infrastructure for generic handling of adapter drivers in
configure and print a summary of the configuration results after
finishing.

The m4 quoting is as conservative as I could get it, and seems
appropriate.

Change-Id: I1655691e5ea0d8eb9e3f67830b96992ffe33640a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1475
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agolibusb: require pkg-config support
Paul Fertser [Wed, 11 Sep 2013 21:07:59 +0000 (23:07 +0200)]
libusb: require pkg-config support

An alternative approach to show how much cleaner the pure pkg-config
way is.

This changes the discovery procedures for libusb-1.0 and libusb-0.1,
making them depend on pkg-config being properly installed and
configured, including the necessary build host configuration for the
cross-builds (see
http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html)

It should make it possible to compile OpenOCD without changes and
extra effort on GNU/Linux, FreeBSD users would need to supply a .pc
file for their libusb implementation or add LIBUSB1_LIBS and
LIBUSB1_CFLAGS to the configure environment.

Change-Id: I826e378dd1e0d101a549a573b2c63212a7e00b64
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1467
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoREADME* refactoring
Paul Fertser [Wed, 11 Sep 2013 21:05:16 +0000 (23:05 +0200)]
README* refactoring

This is an attempt to bring the README files in line with the current
status of the OpenOCD development.

- remove some obsolete information and duplicated instructions
- reword some statements
- restructure in a way more appealing to a regular user
- add a supported hardware list to allow a potential user to determine
  if his/her usecase is covered by a freetext keyword search through
  the document
- Add OSX notes (courtesy GrizzlyAdams and inca)

Since most ftdi-based adapters are now covered by the ftdi driver, I
think it's ok to remove some of the libftdi/ftd2xx instructions, the
few users who still need them should refer to upstream docs instead.

I'm not sure if README.Windows should come with the DOS line endings,
but i'd expect many windows users to use their silly notepad to view
it, and notepad ignores LF apparently. (Decided to use LF anyway.)

I understand discussing and reviewing such a massive README change is
a somewhat demanding task but I feel it's a necessity to move forward
maintaining proper documentation.

Change-Id: Idfde3014c72dd5c32ad292ee1ab205322e51a138
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1503
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
11 years agoflash: add Nuvoton NUC910 series support
Nemui Trinomius [Tue, 16 Jul 2013 15:08:31 +0000 (16:08 +0100)]
flash: add Nuvoton NUC910 series support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: Ic3273e64fd99bffab16764b06227e09a05d07c8f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1510
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
11 years agonds32: remove .soft_reset_halt dependency
Hsiangkai Wang [Wed, 4 Sep 2013 05:21:59 +0000 (13:21 +0800)]
nds32: remove .soft_reset_halt dependency

.soft_reset_halt is not necessary for nds32 target.
Remove the dependency.

Change-Id: Ic3b126d6c7eb995583a661b762627e736222fcaa
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1612
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoaice: add target name to nds command messages
Hsiangkai Wang [Thu, 11 Jul 2013 02:30:41 +0000 (10:30 +0800)]
aice: add target name to nds command messages

Change-Id: Ie6c786c6880fb554af54ed27f1c159326f60a701
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1583
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: support multi-target debugging
Hsiangkai Wang [Tue, 2 Jul 2013 09:29:46 +0000 (17:29 +0800)]
nds32: support multi-target debugging

Change-Id: If767f646b234dbcdb01946e5d13a3a6a29df2d78
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1581
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: Use DMA to access memory as no DCache
Hsiangkai Wang [Thu, 11 Jul 2013 02:08:15 +0000 (10:08 +0800)]
nds32: Use DMA to access memory as no DCache

As GDB uses file-I/O protocol to access memory, use DMA to access
if no DCache.  This commit improves the performance of Andes
Virtual Hosting.

Change-Id: I36bb2154b9f497fc4237625836cf8c7115330a60
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1580
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: modify nds commands implementation
Hsiangkai Wang [Fri, 31 May 2013 03:45:17 +0000 (11:45 +0800)]
nds32: modify nds commands implementation

Modify handle_nds32_memory_access_command: do not use DCache
setting to block user's setting.

Change-Id: I2d33f893773e2a2e3e2f26edde5938ef5902609d
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1579
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: support FreeRTOS
Hsiangkai Wang [Mon, 10 Jun 2013 03:37:24 +0000 (11:37 +0800)]
nds32: support FreeRTOS

Change-Id: I117b5541fb19388c0f5c2344ee42d9151c9a222e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1577
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: report any one of hit read watchpoints
Hsiangkai Wang [Tue, 18 Jun 2013 08:37:21 +0000 (16:37 +0800)]
nds32: report any one of hit read watchpoints

If multiple read watchpoints are hit at the same time, report
any one of these hit watchpoints.

Change-Id: I8d4439aa80e4b62bb7d48bbdc0450920e2008a2e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1576
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: change default value
Hsiangkai Wang [Mon, 10 Jun 2013 03:38:21 +0000 (11:38 +0800)]
nds32: change default value

Change-Id: I0505bdc0e75543a3b205981339c5b9fa78a080ca
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1575
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: always polling after gdb attached
Hsiangkai Wang [Mon, 27 May 2013 05:18:08 +0000 (13:18 +0800)]
nds32: always polling after gdb attached

Do not turn on/off polling as leave/enter debug mode.
Enable polling after gdb attached, and disable polling
after gdb detached.

Change-Id: Id64459b86f44937af7ea5ccfe2cd13e31732eecf
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1574
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: support Andes profiling function
Hsiangkai Wang [Tue, 27 Aug 2013 08:10:16 +0000 (16:10 +0800)]
nds32: support Andes profiling function

Change-Id: Ibc45ec5777d6841956c02de6b4ae8e74c2a6de37
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1585
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agotarget: enhance target profiling
Hsiangkai Wang [Wed, 14 Aug 2013 06:46:58 +0000 (14:46 +0800)]
target: enhance target profiling

1. gprof uses 2-bytes as minimum bucket size.
2. As user wants to use gprof --sum to summarize multiple
   profiling data files, the range MUST be the same.
   Add new arguments to specify profiling range.

Change-Id: Ie7e6afa6a4d82250e2d194a0eed2b428c1479ea1
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1572
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agotarget: add profiling interface
Hsiangkai Wang [Wed, 26 Jun 2013 09:09:40 +0000 (17:09 +0800)]
target: add profiling interface

Profiling could be target-specific.  Add .profiling interface
to target_type.

Change-Id: Ic0eea9db742971db1350a474fbbb5ed24565922b
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1571
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agotarget: increase the maximum number of buckets
Hsiangkai Wang [Fri, 30 Aug 2013 05:45:42 +0000 (13:45 +0800)]
target: increase the maximum number of buckets

I do not know what is the reasonable number of buckets.
If there are enough buckets, the result will be accurate.

I propose increase the maximum number of buckets to 128K.
If the size of program text section is less than 256KB, every
two bytes will be occupied by one buckets.
(The minimum size of one buckets is 2 bytes in gprof implementation.)

Change-Id: If9147743cefdc36f40f21e6dc73b9b28f28c9e1e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1608
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agotarget: Correct profiling calculation
Hsiangkai Wang [Fri, 30 Aug 2013 05:35:08 +0000 (13:35 +0800)]
target: Correct profiling calculation

1. high_pc should be (maximum sample + 1) (Refer to gprof source code)
2. bucket index should be

     sample offset
    --------------- x (number of bucket)
 sample range

For example, if minimum sample is 0 and maximum sample is 5
and the number of bucket is 3.

a = sampled_address - 0
b = 3
c = 6
(a, b, c refer to source code variables)

sampled_address = 0, => a = 0, => bucket_index = 0
sampled_address = 1, => a = 1, => bucket_index = 0
sampled_address = 2, => a = 2, => bucket_index = 1
sampled_address = 3, => a = 3, => bucket_index = 1
sampled_address = 4, => a = 4, => bucket_index = 2
sampled_address = 5, => a = 5, => bucket_index = 2

Change-Id: Ia9fa0e4d9c7183e3e9d7ceaf73e63729f07aa2ce
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1607
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agotarget: Make profiling function more readable
Hsiangkai Wang [Fri, 30 Aug 2013 05:18:54 +0000 (13:18 +0800)]
target: Make profiling function more readable

Change variable name 'length' to 'numBuckets'.  It is more readable.

Change-Id: I913cba0746f887adf6da401a46cd5e9ea88d2c6d
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1606
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agonds32: refine nds32_v2 implement
Hsiangkai Wang [Wed, 17 Jul 2013 02:57:07 +0000 (10:57 +0800)]
nds32: refine nds32_v2 implement

Change-Id: I6e26ffbdcd426a15b34bff022964946f613f318c
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1569
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoaice: support batch commands
Hsiangkai Wang [Tue, 27 Aug 2013 08:02:56 +0000 (16:02 +0800)]
aice: support batch commands

Change-Id: I6846362d98374c93f45f339fb1279fc71721e696
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1584
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoaice: Always setup SDP basic mode
Hsiangkai Wang [Thu, 13 Jun 2013 03:45:10 +0000 (11:45 +0800)]
aice: Always setup SDP basic mode

Change-Id: I1c0c11c2b9097b25324da0591edf036af207dbe9
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1567
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoaice: use keep_alive() to avoid timeout warning messages
Hsiangkai Wang [Fri, 31 May 2013 03:47:22 +0000 (11:47 +0800)]
aice: use keep_alive() to avoid timeout warning messages

As polling $dbger, call keep_alive() to avoid timeout messages.

Change-Id: Ia03d90535c2bd6049763209194c21f70fd8b7e8b
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1566
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agogdb_server: Do not set gdb_con->sync to true for new connections
Anton Kolesov [Tue, 27 Aug 2013 09:38:50 +0000 (13:38 +0400)]
gdb_server: Do not set gdb_con->sync to true for new connections

In GDB connected to OpenOCD there is a command "monitor gdb_sync" which makes
next stepi command to be ignored while GDB still will get an updated target
state. This command sets gdb_connection->sync field to true to notify that stepi
should be ignored. This field is set to true for all new connection and is set
to false after first "continue" command. However if first resume command is
stepi/nexti then it will be ignored and result will confuse GDB client, it will
report that target received signal SIGINT. This patch sets this field to false
for new connections, thus stepi/nexti will work properly when it is a first
resume command.

Change-Id: I7c9ebd69c3dc35f3e316041aa99f4e9d3425c0b6
Signed-off-by: Anton Kolesov <akolesov@synopsys.com>
Reviewed-on: http://openocd.zylin.com/1587
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agosvf: off-by-one error; do not access after the allocated memory
Paul Fertser [Tue, 10 Sep 2013 11:14:56 +0000 (15:14 +0400)]
svf: off-by-one error; do not access after the allocated memory

Keep the promise and ensure there're at least 3 bytes available after
the current position.

This eliminates the errors reported by Valgrind.

Change-Id: I1d0640e904c750eed808b2b4caf419b4d7619845
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1615
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
11 years agotarget: Rewrite read/write buffer default implementations
Andreas Fritiofson [Wed, 13 Mar 2013 22:41:04 +0000 (23:41 +0100)]
target: Rewrite read/write buffer default implementations

Rewrite the target_*_buffer_default to generate as large accesses as
possible while maintaining natural alignment.

These versions are easy to extend to generate 8-byte accesses to support
64-bit targets, although it requires some conformity from all target
implementations (i.e. they need to refuse unsupported access sizes with
some defined error code, so we can try again with a smaller one).

Change-Id: I00ddcbb1d2fd33f9f8b99cb448cc93505a2421fc
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1221
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years ago[RFC] target: Move bulk_write_memory to arm7_9
Andreas Fritiofson [Mon, 11 Mar 2013 21:21:13 +0000 (22:21 +0100)]
[RFC] target: Move bulk_write_memory to arm7_9

The only remaining user is arm7_9 so remove it from the target API and add
it to struct arm7_9_common to support all its variants with minimal
changes. Many of the variants are likely not correct in the cache/mmu
handling when the bulk write is triggered. This patch does nothing to
change that, except for arm946e, where it was easier to do what might be
the right thing.

Change-Id: Ie73ac07507ff0936fefdb90760046cc8810ed182
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1220
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agosysfsgpio: fix a typo in the informational output
Paul Fertser [Tue, 10 Sep 2013 11:27:11 +0000 (15:27 +0400)]
sysfsgpio: fix a typo in the informational output

Change-Id: I0c9bc281e4e913f9eacba3b8b60585217a1caf2e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1616
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
11 years agofm3: add Fujitsu MB9Ax family support
Nemui Trinomius [Tue, 16 Jul 2013 13:44:20 +0000 (14:44 +0100)]
fm3: add Fujitsu MB9Ax family support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: I52048f6e8e66b38087fa249eb66ceab6801d07d5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1506
Tested-by: jenkins
11 years agobuild: remove clang warning about global var 'match'
Spencer Oliver [Thu, 5 Sep 2013 15:36:00 +0000 (16:36 +0100)]
build: remove clang warning about global var 'match'

remove clang warning - "Argument to free() is the address of a global
variable, which is not memory allocated by malloc()".

Change-Id: I015273eafc9644207684b363434c6ae8149bfcde
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1613
Tested-by: jenkins
11 years agoatmega: add new target support
Nemui Trinomius [Tue, 16 Jul 2013 13:58:45 +0000 (14:58 +0100)]
atmega: add new target support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: I6d6af10fb07ea43cc1196a90d8738957f8266938
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1507
Tested-by: jenkins
11 years agoflash: add NXP LPC800 support
Nemui Trinomius [Tue, 16 Jul 2013 14:54:17 +0000 (15:54 +0100)]
flash: add NXP LPC800 support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: I142fa6f29e66fd334baca14217aca97e1fc6c7d9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1509
Tested-by: jenkins
11 years agoarmv7m: use consistent arm.cpsr member
Spencer Oliver [Mon, 5 Aug 2013 16:46:09 +0000 (17:46 +0100)]
armv7m: use consistent arm.cpsr member

We already set cpsr in armv7m_build_reg_cache, so lets use it for all other
accesses to this field.

Change-Id: I19b3b21ecf1571bbea12e1be664845e6544f6fa1
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1539
Tested-by: jenkins
11 years agotarget: remove unimplemented target_request_data implementations
Spencer Oliver [Fri, 2 Aug 2013 12:01:03 +0000 (13:01 +0100)]
target: remove unimplemented target_request_data implementations

Change-Id: Ia9afa83752d17f0f56bdf3bd81f5c69d108aa5e9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1537
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agotarget: check target supports target_request_data
Spencer Oliver [Fri, 2 Aug 2013 11:57:30 +0000 (12:57 +0100)]
target: check target supports target_request_data

Make sure the target support target requests before we enable any receivers.

Change-Id: I8ce42922eaff76fb5e7a114da716f2a6585a6ab5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1536
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agotarget: remove unimplemented soft_reset_halt implementations
Spencer Oliver [Fri, 2 Aug 2013 11:14:37 +0000 (12:14 +0100)]
target: remove unimplemented soft_reset_halt implementations

Let the default handler issue an unsupported warning rather than using
empty handler routines that may/may not issue a unsupported warning.

Change-Id: Iafe3e45146981a4cfae39771c3ab7370ac86da48
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1535
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com>
11 years agortos: Do not dereference null pointers
Spencer Oliver [Mon, 19 Aug 2013 13:42:53 +0000 (14:42 +0100)]
rtos: Do not dereference null pointers

detected by clang.

Change-Id: Id395f9d33bc2903b29a158fc3540ae51857e6aa0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1555
Tested-by: jenkins
11 years agomini51: support for Nuvoton NuMicro Mini51 series flash memory
Cosmin Gorgovan [Fri, 9 Aug 2013 16:52:46 +0000 (17:52 +0100)]
mini51: support for Nuvoton NuMicro Mini51 series flash memory

Adds a flash driver for Nuvoton MINI51, MINI52 and MINI54 microcontrollers.

At the moment, it only supports the erase and write operations.

These microcontrollers have a 4 / 8 / 16 KB APROM for application code and a
2 KB LDROM for bootloaders. When the MCU has booted off the APROM, the LDROM
isn't mapped in memory but can be programmed, and the other way around.
This means that the ARM core is typically rebooted for programming. After a
successful write or erase operation, it is rebooted again, using the initial
boot source.

This driver only supports programming the APROM.

This driver is a pure JTAG implementation, it doesn't use any SRAM.

I've tested it on a MINI54ZAN microcontroller using an ST-LINK/V2. With the
microcontroller running at the default clock frequency of 22.1184 MHz, speed
seems to be around 1.1 KB/s.

Change-Id: I180889c55af9fb5614cd99a953b755baba14288a
Signed-off-by: Cosmin Gorgovan <cosmin@linux-geek.org>
Reviewed-on: http://openocd.zylin.com/1546
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agokinetis: add kl flash support
Spencer Oliver [Thu, 5 Sep 2013 14:49:56 +0000 (15:49 +0100)]
kinetis: add kl flash support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391
depends on http://openocd.zylin.com/1602

Change-Id: Ib846be48500a28d515c6dbd3ca2a5c1719cd74d4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1508
Tested-by: jenkins
Reviewed-by: Chris Fryer <chrisf1874@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
11 years agojtag: drivers: Add JTAP VPI client driver
Franck Jullien [Fri, 6 Sep 2013 16:42:39 +0000 (18:42 +0200)]
jtag: drivers: Add JTAP VPI client driver

This patch adds a driver for the jtag_vpi server [1]. This server is
now part of the ORPSoC version 3 (OpenRISC Reference Platform SoC).
The jtag_vpi server provides an interface between OpenOCD and a simulated
core.

[1] http://github.com/fjullien/jtag_vpi

Change-Id: I717b72cace4845f66c878581345074f99002e21a
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1609
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agogdb server: do not free tdesc_filename early
Spencer Oliver [Fri, 16 Aug 2013 14:37:32 +0000 (15:37 +0100)]
gdb server: do not free tdesc_filename early

Issue caught by clang.

Change-Id: I4fb331574512140b36e56b3b7ab7e8bdad5e013d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1554
Tested-by: jenkins
11 years agodocs: add RTOS Support info
Spencer Oliver [Mon, 5 Aug 2013 10:41:15 +0000 (11:41 +0100)]
docs: add RTOS Support info

Currently we have very little info about the RTOS support. This should
improve that.

We also add info about what symbols are required for each supported RTOS.
This can be a trap, certainly when trying to use FreeRTOS support.

Change-Id: Ie57858571daca97515292ff5738a5a5ef55655b7
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1538
Tested-by: jenkins
11 years agocfg: EFM32 supports SYSRESETREQ so use it
Spencer Oliver [Tue, 6 Aug 2013 12:15:18 +0000 (13:15 +0100)]
cfg: EFM32 supports SYSRESETREQ so use it

Change-Id: If52fdea025a2f9620ad4ddacfb83cbb83a94944d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1541
Tested-by: jenkins
11 years agoflash: fix stm32f1x dual bank detection
Spencer Oliver [Tue, 6 Aug 2013 13:36:12 +0000 (14:36 +0100)]
flash: fix stm32f1x dual bank detection

Not all devices with devce id 0x419 have dual flash banks, only those
with > 1024kB.

Change-Id: I197d2b87df7599cd0837e25648af48439f2f1e50
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1544
Tested-by: jenkins
11 years agoefm32: set safe minimum working area
Spencer Oliver [Tue, 20 Aug 2013 22:30:49 +0000 (23:30 +0100)]
efm32: set safe minimum working area

The smallest available RAM size for this family is 2K, set this as the
default. Issue reported by quitte on IRC.

Change-Id: I3318f7f268f7681ffe2cddab61820f4b94c4e5fd
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1559
Tested-by: jenkins
11 years agotarget: Remove error messages as no .get_gdb_fileio_info
Hsiangkai Wang [Wed, 28 Aug 2013 02:59:29 +0000 (10:59 +0800)]
target: Remove error messages as no .get_gdb_fileio_info

If target does not support semi-hosting function, it has
no need to provide .get_gdb_fileio_info callback. OpenOCD
will use default function target_get_gdb_fileio_info_default.
The default function just return ERROR_FAIL and gdb_server
will treat every halted condition as normal halted and
return "Txx" to gdb.

Change-Id: I9ddb2be3a1145eae2ef5b712bdea89eb2e0fbc20
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1586
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agostlink: Add workaround for intermittent FW info retrieval failure
Andrey Smirnov [Tue, 20 Aug 2013 19:26:19 +0000 (12:26 -0700)]
stlink: Add workaround for intermittent FW info retrieval failure

It appears that on some host USB configurations(2012 MacBook Air)
multiple restarts of openocd tool cause the FW on STLINKv2 dongle to
go into a weird state in which it will no longer respond to
STLINK_GET_VERSION command. This patch adds code that, if said request
fails for the first time, attempts to reset the device and retry to
initialize it and obtain FW information one more time.

Change-Id: I7227fc972adb49d52ae700ad48ab9f66b2aaa72c
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/1561
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agostlink_usb: remove gcc-specific constant
Andrey Yurovsky [Wed, 21 Aug 2013 03:15:36 +0000 (20:15 -0700)]
stlink_usb: remove gcc-specific constant

Replace 0b10 with 0x02, 0b is a GCC extension and isn't supported by
clang, for instance, so compiling on OS X will fail.  No functional
changes.

Change-Id: Ie882be1563df03e7ad3da0bc9aee65a907a29549
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1560
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoAdded new ftdi interface device
Pushpal Sidhu [Fri, 23 Aug 2013 22:58:50 +0000 (15:58 -0700)]
Added new ftdi interface device

Added new configuration file for gw16042 device.
Also added this to interface/ftdi examples in documentation.

Change-Id: I07bb10bfc79a5d13007288cd57f254d889075214
Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Reviewed-on: http://openocd.zylin.com/1563
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agodoc: Add gdb target description commands
Franck Jullien [Thu, 15 Aug 2013 19:52:23 +0000 (21:52 +0200)]
doc: Add gdb target description commands

Change-Id: Ie74917082e894cfa8ee2258f7a8cdf7d58ee4a59
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1552
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agodoc: update GW16042 hardware information
Pushpal Sidhu [Thu, 15 Aug 2013 21:03:49 +0000 (14:03 -0700)]
doc: update GW16042 hardware information

Fixed a typo in device name as well updated device URL. Also fixed
miscategorization and moved it to USB FT2232 Based section.

Change-Id: Ia3acaed4209eff26244efea8db68046143ecea37
Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Reviewed-on: http://openocd.zylin.com/1553
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agointerface/ftdi/tumpa: remove ftdi_device_desc as it's incorrect
Paul Fertser [Tue, 13 Aug 2013 17:52:37 +0000 (21:52 +0400)]
interface/ftdi/tumpa: remove ftdi_device_desc as it's incorrect

The end users on IRC report that actual USB device has different
information in its descriptor so it doesn't match. Remove it
altogether.

Change-Id: Id7841667390a514581e630e67b9283675803135b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1548
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoAdd tcl configurations for Altera Soc devices
Brad Riensche [Tue, 9 Jul 2013 21:28:14 +0000 (16:28 -0500)]
Add tcl configurations for Altera Soc devices

This commit adds two tcl configuration files, one for the Altera
Cyclone V SoC series, and one for the SoCkit development board.
The board configuration is able to halt and resume the cpu cores,
and dump register contents etc.  It has not been fully tested, however.

Change-Id: Id3f18c3408975cf986a5f5aec410b5b13240c35e
Signed-off-by: Brad Riensche <brad.riensche@gmail.com>
Reviewed-on: http://openocd.zylin.com/1494
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agostm32lx flash: fix flash size for Medium+ devices
Andrey Yurovsky [Tue, 23 Jul 2013 00:26:02 +0000 (17:26 -0700)]
stm32lx flash: fix flash size for Medium+ devices

Unfortunately the Medium+ density and 0x436 devices have their F_SIZE register
at a different location: 0x1FF800CC instead of 0x1FF8004C.  Fix this for
the 0x427 Medium+ devices and also the 0x436 devices.  Furthermore, for
0x436 devices the flash size is reported as a 0 or 1 code rather than
the size in Kb.  Please see RM0038 r8 or newer for an explanation, as
noted in the comments.

Change-Id: Ie03b1e119a61f2a854bc2ccc5f90ce3e8852e272
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1522
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoremove the untested warning in ftdi/olimex-arm-usb-tiny-h.cfg
Sergey Alirzaev [Fri, 9 Aug 2013 13:41:56 +0000 (17:41 +0400)]
remove the untested warning in ftdi/olimex-arm-usb-tiny-h.cfg

the dongle seems working, including srst signal

Change-Id: I5da9046bd8a35d8d826f1b663c01bd2600a6cf14
Signed-off-by: Sergey Alirzaev <zl29ah@gmail.com>
Reviewed-on: http://openocd.zylin.com/1545
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agodocs: remove mixed case typo
Spencer Oliver [Tue, 6 Aug 2013 11:34:51 +0000 (12:34 +0100)]
docs: remove mixed case typo

Change-Id: Iae40c59ed21e72931d440814d112b3cd752aad9c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1540
Tested-by: jenkins
11 years agotarget: clear running_alg flag after reset
Paul Fertser [Wed, 17 Jul 2013 05:47:43 +0000 (09:47 +0400)]
target: clear running_alg flag after reset

After the target was reset we can be sure it's not running any
algorithm.

This fixes the following failure scenario:

On my STM32F103 board after I start the firmware and then stop and try
to "load" in gdb (before doing mon reset halt), I get

Error: timeout waiting for algorithm, a target reset is recommended

However, target reset doesn't help as the flag is still there ("Error:
Target is already running an algorithm"), so I have no choice but to
restart the OpenOCD process.

I'm not sure yet what exactly prevents load from working after my
firmware is initialised, most probably some interrupt is firing and my
handler produces a fault due to garbled RAM.

Change-Id: Idd977f2780a64d84800e3abd412cffc1ab6801b0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1512
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomdr32fx: support for Milandr's MDR32Fx internal flash memory
Paul Fertser [Mon, 29 Jul 2013 13:22:07 +0000 (17:22 +0400)]
mdr32fx: support for Milandr's MDR32Fx internal flash memory

This adds example config and flash driver for russian Cortex-M3
microcontroller model.

Run-time tested on MDR32F9Q2I evaluation board; the flash driver
should be compatible with MDR32F2x (Cortex-M0) too but I lack hardware
to test.

There're no status bits at all, the datasheets specifies some delays
for flash operations instead. All being in <100us range, they're hard
to violate with JTAG, I hope. There're also no flash identification
registers so the flash size and type has to be hardcoded into the
config.

The flashing is considerably complicated because the flash is split
into pages, and each page consists of 4 interleaved non-consecutive
"sectors" (on MDR32F9 only, MDR32F2 is single-sectored), so the
fastest way is to latch the page and sector address and then write
only the part that should go into the current page and current sector.

Performance testing results with adapter_khz 1000 and the chip running
on its default HSI 8MHz oscillator:

When working area is specified, a target helper algorithm is used:
wrote 131072 bytes from file testfile.bin in 3.698427s (34.609 KiB/s)

This can theoretically be sped up by ~1.4 times if the helper
algorithm is fed some kind of "loader instructions stream" to allow
sector-by-sector writing.

Pure JTAG implementation (when target memory area is not available)
flashes all the 128k memory in 49.5s.

Flashing "info" memory region is also implemented, but due to the
overlapping memory addresses (resulting in incorrect memory map
calculations for GDB) it can't be used at the same time, so OpenOCD
needs to be started this way: -c "set IMEMORY true" -f
target/mdr32f9q2i.cfg

It also can't be read/verified because it's not memory-mapped anywhere
ever, and OpenOCD NOR framework doesn't really allow to provide a
custom handler that would be used when verifying.

Change-Id: I80c0632da686d49856fdbf9e05d908846dd44316
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1532
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agostlink: add SWO tracing support
Andrey Yurovsky [Tue, 23 Jul 2013 06:39:51 +0000 (23:39 -0700)]
stlink: add SWO tracing support

Enable reading the SWO trace output via STLinkv2 dongles that support
it.

This adds an optional initialization parameter "trace" with which the user
specifies a destination file where SWO trace output is appended as it comes in
as well as the trace module's source clock rate.

STLink will be configured for a 2MHz SWO data rate (STLink's highest
supported rate) if the source clock is > 2MHz, otherwise the source
clock is used as the data rate directly.

For example:

trace swo.log 168000000

If "trace" is specified with a usable file path, the stlink_usb driver will
attempt to configure and read SWO trace data as follows:
- on _run(), the target's TPI and TMI are configured and the STLinkv2 is told
  to enable tracing.  Only generic ARM TPI and TMI registers are
  configured, any MCU-specific settings (ex: pin routing) are the
  responsibility of the target firmware.  The configuration applied is
  based on the STLinkv2's capabilities (UART emulation).
- on _v2_get_status(), the trace data (if any) is fetched from the
  STLink after the target status is checked and the target is found to
  be running.
- on _halt(), the STLink is told to disable tracing.

When fetching trace data, the entire trace frame is written to the output file
and that data is flushed.  An external tool may be used to parse the
trace data into a more human-readable format.

Tested on ARM Cortex M4F and M3 MCUs (STM32F407 and STM32L152).

Change-Id: Ic3983d46c82ba77010c23b0e18ce7b275d917f12
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1524
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agogdb_server: check target before executing event callback
Hsiangkai Wang [Thu, 11 Jul 2013 02:44:59 +0000 (10:44 +0800)]
gdb_server: check target before executing event callback

As debugging multi-targets, every target has its own gdb connection.
If there are two connections, gdb_target_callback_event_handler will
be registered twice.  Everytime event occurs, the registered callback
will be executed twice.  If both targets are running, as user issues
ctrl-c in one gdb client, both connections will send "stop reply" to
GDB clients even TARGET_EVENT_GDB_HALT is caused by one of them.

The commit fix above problem as debugging multi-targets.

Change-Id: I1e12d4846927d7dcf1e3bb9aeb1affabc80df813
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1501
Tested-by: jenkins
Reviewed-by: Sergey Borshch <sb-sf@users.sourceforge.net>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agogdb_server: add target_debug_reason for program exit detection
Hsiangkai Wang [Wed, 6 Mar 2013 01:39:52 +0000 (09:39 +0800)]
gdb_server: add target_debug_reason for program exit detection

Currently, there is no way to notify gdb that program has exited.
Add new target_debug_reason called DBG_REASON_EXIT to notify gdb
the condition has occured. If the debug reason is DBG_REASON_EXIT,
gdb_server will send 'W' packet to tell gdb the process has exited.

Change-Id: I7a371da292716a3e6ac4cc2c31b009a651fe047a
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1242
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agogdb_server: support File-I/O Remote Protocol Extension
Hsiangkai Wang [Wed, 2 Jan 2013 04:02:00 +0000 (12:02 +0800)]
gdb_server: support File-I/O Remote Protocol Extension

The File I/O remote protocol extension allows the target to use the
host's file system and console I/O to perform various system calls.

To use the function, targets need to prepare two callback functions:
* get_gdb_finish_info: to get file I/O parameters from target
* gdb_fileio_end: pass file I/O response to target

As target is halted, gdb_server will try to get file-I/O information
from target through target_get_gdb_fileio_info(). If the callback function
returns ERROR_OK, gdb_server will initiate a file-I/O request to gdb.
After gdb finishes system call, gdb will pass response of the system call
to target through target_gdb_fileio_end() and continue to run(continue or step).

To implement the function, I add a new data structure in struct target,
called struct gdb_fileio_info, to record file I/O name and parameters.

Details refer to GDB manual "File-I/O Remote Protocol Extension"

Change-Id: I7f4d45e7c9e967b6d898dc79ba01d86bc46315d3
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1102
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agogdb server: new feature, add stop reason in stop reply packet for gdb
Hsiangkai Wang [Wed, 26 Dec 2012 11:11:03 +0000 (19:11 +0800)]
gdb server: new feature, add stop reason in stop reply packet for gdb

In GDB remote serial protocol, the stop reply packet could contain more
detail stop reason. The currently defined stop reasons are listed below.

* watch
* rwatch
* awatch
* library
* replaylog

This commit adds stop reason, watch/rwatch/awatch, in stop reply packet for
just hit watchpoint. As manual indicates, at most one stop reason should be present.

The function needs target to implement new hook, hit_watchpoint. The hook will fill
the hit watchpoint in second parameter. The information will assist gdb to locate
the watchpoint. If no such information, gdb needs to scan all watchpoints by itself.

Refer to GDB Manual, D.3 Stop Reply Packets

Change-Id: I1f70a1a9cc772e88e641b6171f1a009629a43bd1
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1092
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agogdb_server: support gdb target description
Hsiangkai Wang [Tue, 7 May 2013 13:43:35 +0000 (21:43 +0800)]
gdb_server: support gdb target description

* Add a parameter in .get_gdb_reg_list() to return different
  register lists as generating target description.
* Modify STRUCT REG to let gdb generate target description
  according to register information.

The modified structure of register is
struct reg {
        const char *name;
        uint32_t number;  /* for regnum="num" */
        struct reg_feature *feature;  /* for register group feature name */
        bool caller_save;  /* for save-restore="yes|no" */
        void *value;
        bool dirty;
        bool valid;
        bool exist;
        uint32_t size;
        struct reg_data_type *reg_data_type;  /* for type="type" */
        const char *group;  /* for group="general|float|vector" */
        void *arch_info;
        const struct reg_arch_type *type;
};

Change-Id: I2096b67adf94518ba0b8b23d8c6a9f64ad7932b8
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1382
Tested-by: jenkins
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agojtag/drivers: usb_blaster cheap clone documentation
Robert Jarzmik [Mon, 22 Jul 2013 21:41:51 +0000 (23:41 +0200)]
jtag/drivers: usb_blaster cheap clone documentation

Add documentation about the cheap clone based on the Cypress
chip. The documentation has schematics data, and throughtput
mesures.

Change-Id: I51bf19ff9229565e178dd4c1231682bd9b4b7a8b
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-on: http://openocd.zylin.com/1520
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoflash: add Winbond w25q80bv spi support
Nemui Trinomius [Tue, 16 Jul 2013 15:26:59 +0000 (16:26 +0100)]
flash: add Winbond w25q80bv spi support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: Ibe87c617b3cdf70ee042112609ab46bea98a3e6d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1511
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agoimx6: add new id for SJC as found on i.MX6D
Paul Fertser [Tue, 30 Jul 2013 08:49:08 +0000 (12:49 +0400)]
imx6: add new id for SJC as found on i.MX6D

Austriancoder on IRC reports getting this ID on his board.

Change-Id: Ie859f0ee422e18fdb94bf817cdd2b41d15b968da
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1533
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agompsse: Add missing read buffer checks
Andreas Fritiofson [Wed, 10 Jul 2013 17:22:42 +0000 (19:22 +0200)]
mpsse: Add missing read buffer checks

These two unused functions added reads without checking for available
space.

Change-Id: I17dbbe9988b057e5a3a1768f405fc9d1027d1c01
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1500
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agompsse: Defer errors until flush
Andreas Fritiofson [Wed, 10 Jul 2013 17:06:29 +0000 (19:06 +0200)]
mpsse: Defer errors until flush

Simplify the API by making all MPSSE command functions return void instead
of an error code. If there is an error during an implicit flush in a
command call, further commands are ignored until an explicit flush is
performed. The flush function returns and clears any error code set.

The only command functions that still return an error code are those that
can fail directly based on the type of the FTDI chip, i.e. when trying to
enable RCLK or divide-by-5 on a non-high-speed chip.

Adapt the ftdi adapter driver to the new API.

Change-Id: I12979c723c81f7fd022c25821b029112f02b3f95
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1499
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agodocs: add missing embKernel rtos arg to docs
Spencer Oliver [Thu, 25 Jul 2013 15:58:12 +0000 (16:58 +0100)]
docs: add missing embKernel rtos arg to docs

Change-Id: Ib304a2bf272d281f6cd124ffca95b32531d57899
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1529
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
11 years agoconfigure.ac: Remove obsolete(?) oddity
Andreas Fritiofson [Thu, 25 Jul 2013 19:39:58 +0000 (21:39 +0200)]
configure.ac: Remove obsolete(?) oddity

It causes build failure by adding the build system's includes to the
compiler's search path when cross-compiling with --prefix=/usr.

Building seems to work fine without it. It was added in f7274784. No idea
what it was trying to solve that couldn't be covered in a better way.

Change-Id: Ia32863f0b0cbd498eb34bd2fce73126db5b71a1f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1530
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
11 years agoFix out-of-tree build
Andreas Fritiofson [Thu, 25 Jul 2013 01:21:53 +0000 (03:21 +0200)]
Fix out-of-tree build

The current AX_CONFIG_SUBDIR_OPTION macro assumes that $srcdir is a
relative path. If it is not, jimtcl/configure.gnu is generated such that
an out-of-tree build will fail at the configure step unless the build dir
is a sibling to the source dir.

Change the generated jimtcl/configure.gnu wrapper to use the same
`dirname $0` trick as jimtcl/configure (which itself is a wrapper around
autosetup).

Change-Id: I0fb19ae114ba37169b422b28313262f9bd83eb6f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1528
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
11 years agoautomake: use subdir-objects option
Paul Fertser [Sat, 20 Jul 2013 17:39:55 +0000 (21:39 +0400)]
automake: use subdir-objects option

Automake 1.14 introduced several non-fatal warnings that should help
projects prepare to the next major automake release (2.0).

Considering the way OpenOCD automake files are written, using
subdir-objects doesn't have any adverse effects, so enable it for the
future compatibility.

Change-Id: I3e7fd93d1b53c5a7ed00ec0f03d2d1510a07f516
Reported-by: Freddie Chopin <freddie_chopin@op.pl>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1517
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agolpcspifi: assume flash is unprotected after probing
Paul Fertser [Tue, 23 Jul 2013 16:15:32 +0000 (20:15 +0400)]
lpcspifi: assume flash is unprotected after probing

Since the driver doesn't support any hardware flash protection, it
doesn't make sense to report "protected" status after probing, as it
requires extra commands to unprotect before flashing and might be
confusing for the end-users.

Change-Id: I04d96790cc42412df5334951f39fb6723c972ced
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1525
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agostm32f2x flash: add STM32F401 (F4 low power)
Andrey Yurovsky [Mon, 22 Jul 2013 23:49:02 +0000 (16:49 -0700)]
stm32f2x flash: add STM32F401 (F4 low power)

Add support for the new STM32F401 parts.  These are similar to the
STM32F405/407 however they are a new Low Power variant with ID code
0x423 and have 256K of Flash.  Tested with a modified F4 discovery
board.

Change-Id: Ida5fb14a0832934b4d6d1ec11e602df5076edbc8
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1521
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agortos: issue warning on auto detect failure
Spencer Oliver [Wed, 17 Jul 2013 14:24:29 +0000 (15:24 +0100)]
rtos: issue warning on auto detect failure

Currently if we fail to auto detect an rtos then no warning is given.
This can also be triggered if we only find some of the rtos symbols.

Change-Id: I215991bbce0909bc6af93560b0f55db13defd123
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1514
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agocortex_m: change cmd output to use cortex_m rather than cortex_m3
Spencer Oliver [Wed, 17 Jul 2013 09:59:00 +0000 (10:59 +0100)]
cortex_m: change cmd output to use cortex_m rather than cortex_m3

Change-Id: I33834910c44d22169bcf684e9697a8db49d0b396
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1513
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
11 years agotarget: fix halt and wait_halt timeout units
Paul Fertser [Tue, 16 Jul 2013 06:00:42 +0000 (10:00 +0400)]
target: fix halt and wait_halt timeout units

Documentation says they should be given values in milliseconds,
DEFAULT_HALT_TIMEOUT matches that too.

Change-Id: Ic1a30fa90f75b412c43fe50ba187d01c3d0a5fba
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1504
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agoetm: prevent segfault when reading bogus information
Paul Fertser [Tue, 16 Jul 2013 07:29:15 +0000 (11:29 +0400)]
etm: prevent segfault when reading bogus information

When I do not have the JTAG adapter connected to the target, I often
end up always reading 1s from the chain. If the OpenOCD is configured
to connect to an ETM-equipped target (i.MX25 ARM9 in my case), this
results in writing garbage values in the etm reg_cache as the ETM bit
fields for the comparators, counters and outputs are wider than the
amount of entries in the corresponding arrays. This later results in a
segfault in the first etm_reg_lookup() call.

Change-Id: Ied81fdbf3a53a3dd749e2e5e97adf86c012df575
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1505
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomips: add breakpoint support for EJTAG 2.0
Oleksij Rempel [Mon, 15 Apr 2013 10:10:04 +0000 (12:10 +0200)]
mips: add breakpoint support for EJTAG 2.0

EJTAG 1.5, 2.0 and 2.5 have different breakpoint register addresses.
This patch add support of EJTAG 2.0, which is part some broadcom
SoCs.

This work was testet on Broadcom BCM7401.

Change-Id: I4b0ee23871fa9205f9001b7c9165e7b6ebe9ccbf
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1464
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomips32: add new functions mips32_configure_ibs and _dbs
Oleksij Rempel [Wed, 26 Jun 2013 08:56:23 +0000 (10:56 +0200)]
mips32: add new functions mips32_configure_ibs and _dbs

Split function mips32_configure_break_unit
to mips32_configure_ibs and mips32_configure_dbs
to make code more readable.

This will probably make work easyer with differnet EJTAG versions.

Change-Id: I666f949fd7bc3656bdf75e7bcaadb164f15855dd
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1463
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomips32_pracc: jump to 0xff20.0200 if cpu reads wrong addr
Oleksij Rempel [Sat, 20 Apr 2013 12:27:39 +0000 (14:27 +0200)]
mips32_pracc: jump to 0xff20.0200 if cpu reads wrong addr

On some CPUs, like bcm7401 with EJTAG v2.0 we can have situation where
CPU do not stops execution. For example, all CP0 commands will have this issue.
In this case we should some hove recover our session. Currently
jump to 0xff20.0200 seems to be good option. If it brake some thing on
newer EJTAG, then check for EJTAG v2.0 should be added.

Change-Id: Icd8841f38a1a85e0f7682b6dc358af8dfaae0744
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Reviewed-on: http://openocd.zylin.com/1353
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomips32: add jump instruction
Oleksij Rempel [Mon, 15 Apr 2013 07:40:21 +0000 (09:40 +0200)]
mips32: add jump instruction

This instruction we will need to make jump to 0xff20.0000

Change-Id: Ic723e683e8848492cd8e186e71fd668dbd1d97e6
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Reviewed-on: http://openocd.zylin.com/1338
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agodo not wait forever on ejtag_dma_dstrt_poll
Oleksij Rempel [Thu, 18 Apr 2013 10:00:14 +0000 (12:00 +0200)]
do not wait forever on ejtag_dma_dstrt_poll

Change-Id: I26adab09839795ecf363b7db912392bd5314cec5
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Reviewed-on: http://openocd.zylin.com/1344
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomips32_dmaacc: add new funct ejtag_dma_dstrt_poll
Oleksij Rempel [Thu, 18 Apr 2013 09:47:22 +0000 (11:47 +0200)]
mips32_dmaacc: add new funct ejtag_dma_dstrt_poll

Change-Id: I8472a85032e397445408dce917f60c8e6ce852e2
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Reviewed-on: http://openocd.zylin.com/1343
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
11 years agomips_ejtag: remove memory protection bit before DM
Oleksij Rempel [Mon, 15 Apr 2013 05:58:40 +0000 (07:58 +0200)]
mips_ejtag: remove memory protection bit before DM

Change-Id: Id1564ae063cea4f056b350436d52df5381ca9608
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Reviewed-on: http://openocd.zylin.com/1341
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>