Commit Graph

5152 Commits

Author SHA1 Message Date
Paul Fertser 11a1080c00 svf: try to reallocate buffers if they're not enough
On larger FPGAs the default buffer size is not nearly enough;
automatically reallocate it as needed.

Change-Id: Ic8071e8cceddeef897ce76996c029250fd22662b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2099
Tested-by: jenkins
Reviewed-by: Kenneth Lorthioir <ibelimb@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-04-14 18:21:11 +00:00
Seth LaForge 3427cf2b7e cortex_a: fix endiannes issues on TI TMS570
The TI TMS470 and TMS570 series of processors are BE-32 processors,
despite BE-32 not being supported by ARM in the Cortex-R4 core. TI
hacked in BE-32 support, which requires odd swizzling in OpenOCD to
make memory reads and writes function correctly. In particular,
without this change, OpenOCD word reads and writes had the bytes
reversed, and halfword and byte packed reads were reading garbage.
In my testing, this change fixes these problems.

Change-Id: I21dd30f4b9003f20fcc85f674ab833407bb61f74
Signed-off-by: Seth LaForge <sethml@google.com>
Reviewed-on: http://openocd.zylin.com/2064
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-04-14 18:20:36 +00:00
Spencer Oliver 31496c2bed usb_blaster: fix warning: array subscript has type ‘char’
caught by clang 3.4 running on cygwin.

Change-Id: I59f652337334e557fb50374f5270ba9c30392b6e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2100
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2014-04-14 18:19:56 +00:00
Paul Fertser 151c31785a mips32, dsp563xx: fix segfault on Gdb attach
Since c6216201b2 gdb target description
generation support is enabled by default and it counts on checking
"feature" pointer in reg_list. Both mips32 and dsp563xx neither used
calloc nor explicitly set feature (as it was a newly introduced struct
field).

This patch changes all targets to use calloc for consistency.

Change-Id: I9eceadef8b04aacb108e24ae23cb51ca3009586f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2102
Tested-by: jenkins
Reviewed-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-04-14 18:18:13 +00:00
Paul Fertser 3a590658e9 jtag/drivers/remote_bitbang: use sizeof to determine maximum unix socket path length
Different *nix systems use different constants, so sizeof should be
used instead. This fixes the build on OS X (as sun_path length is
hardcoded to 104 on Darwin).

Change-Id: I1df611383dedcfc6d153ec59b453a895c7d84e94
Reported-by: Xiaofan Chen <xiaofanc@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2095
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2014-04-14 18:16:52 +00:00
Tim Sander 4835a21dea target: fix incorrect arm cpu monitor mode encoding
According to the "Arm Arch Ref Manual ARMv7-a and ARMv7-R edition" the
CPSR encoding for Monitor mode is 0b10110 (22) not 0b11010 (26) as is
currently used.

Change-Id: I73373a0029a81abc92febf518b88bf0dd4dec1fa
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2081
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Tested-by: jenkins
Reviewed-by: Younes REGAIEG <y.regaieg@gmail.com>
Reviewed-by: Tim Sander <tim@krieglstein.org>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2014-04-14 18:15:57 +00:00
Karl Hammar 7256d6acdf parport: add "aspo" hotpluggable adapter config
This adds a new adapter config.

Design files are available from:

http://turkos.aspodata.se/git/openhw/isp/pp_jtag_arm20.sch
http://turkos.aspodata.se/git/openhw/isp/pp_jtag_arm20.pcb

No need to document it anywhere as only a single device was ever
built.

Change-Id: If031fdb9dedb1e544401747bfb7fbc5afc4d5407
Signed-off-by: Karl Hammar <karl@aspodata.se>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2094
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-04-14 18:13:03 +00:00
Paul Fertser ee54f7e9f0 target/cortex_a: check gdb_service before dereferencing in update_halt_gdb
If gdb was disconnected by the moment the target entered halted state,
update_halt_gdb would segfault.

Change-Id: I67477e9199c1df097be83a49e38602f975c083f5
Reported-by: Younes REGAIEG <younes.regaieg@imag.fr>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2098
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-04-14 18:12:30 +00:00
Paul Fertser 45f71f1082 Makefile.am: fix build for libftdi1, pass CFLAGS where appropriate
Change-Id: I9d8afa6ae32fc01e69ec434b5bc9d71524d386a2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2079
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2014-04-14 18:09:40 +00:00
Paul Fertser 9f2bc3b830 jtag/aice/aice_usb: remove unused constants
Those are breaking the build with clang 3.4 (current default compiler
on OS X 10.9.2).

Change-Id: I9f2fbfbb6d544498cb8d6a62565e4ebe7223e784
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2077
Tested-by: jenkins
Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com>
2014-04-08 11:37:36 +00:00
Paul Fertser 61905a165f flash/nor/at91sam3: remove sam3_page_write_opcodes
Apparently this helper was never actually used, and current clang
produces an unused const variable warning, so it's breaking the build.

Change-Id: Ib088bef5e9c0a48942c1d417d46f738469ee7e28
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2076
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2014-04-08 11:34:53 +00:00
Andreas Fritiofson e6907e6d7e Don't cast return value of [cm]alloc
Change-Id: I0028a5b6757b1ba00031893d9a2a1725f915a0d5
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2069
Tested-by: jenkins
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-30 03:53:45 +00:00
Andrey Smirnov dba153bbce at91smad: Fixes to 'samd_protect'
Some fixes to 'samd_protect' including:
     - Fix a bug in which the value of 'set' parameter passed into the
     function was ignored so it was impossible to remove flash
     protection once it was set.
     - Check the protection status of the sector via 'is_protected'
     field of the  corresponding 'flash_sector' structure to see if
     any actual HW manipulations needs to be done.
     - Change the way the errors during protection activation are
     handled. Now even in the case of error in the middle of
     protecting a number of sectors the subroutine would still update
     the state of the sector protection in sectors array so as to
     avoid cases where openocd thinks that the sector is not protected
     while it actually is.

Change-Id: I4cc6445a98ec13bdd94c89f0711c17840738a215
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2027
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 08:44:16 +00:00
Andrey Smirnov c92a605e26 at91samd: Bail early if trying to erase protected sector
Bail early if trying to erase protected sector and also do not double-erase already
erased sectors.

Change-Id: Ic2d39af48c3b8e10e78d52dd978b9bc01f671c6a
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2026
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 08:44:08 +00:00
Andrey Smirnov 34db6b9c0a at91samd: Bail early if trying to write to protected sector
Bail early if trying to write to protected sector also mark the sector
we are writing to as dirty.

Change-Id: I892f83461792e1cc2dcccade7aa65717831a6805
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2025
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 08:43:52 +00:00
Andrey Smirnov e0f0ce965d at91samd: Remove 'first' and 'last' checks in 'samd_erase'
Remove 'first' and 'last' checks in 'samd_protect' since those
parameters are checked in 'handle_flash_erase_command'.

Change-Id: I30e5598a9ab656d81055f26cc63e291377605300
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2024
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 08:43:43 +00:00
Paul Fertser 207237b920 tcl: introduce init_target_events and use it for gdb flashing events
This introduces a new global Tcl procedure that is run just after
init_targets and before init_boards.

Its default behaviour is to assign gdb-flash-erase-start and
gdb-flash-write-end to reasonable defaults.

The rationale for doing "reset init" before gdb erases and flashes
memory is that all flash drivers are written in assumption that they
can safely be used only after chip reset (plus chip-specific
configuration in the init handler if any). The need to use "reset
halt" after flashing is because a user expects running firmware after
loading to be the same as running it from power-on-reset.

Change-Id: I9ddc4047611904ca4ca779b73376d2739611948a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2062
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 08:40:03 +00:00
Spencer Oliver 0f566ae1a7 target: remove memory leaks
Found by clang.

Change-Id: Ifb25dca52f8d9e8e46a35f0947a7239f26eb3757
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2067
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
2014-03-29 08:04:55 +00:00
Spencer Oliver 0cb9778368 target: fix handle_profile_command variable typo
Change-Id: I5d476aecb4622731890e168b1be3173718151e95
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2066
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-29 08:04:47 +00:00
Spencer Oliver e22bad797f target: remove handle_profile_command memory leak
COMMAND_PARSE_NUMBER may return, thus any memory allocated may not be
freed, simple reorder fixes the issue.

Change-Id: I0ce444a5b032f5c49b6d33a03a8c0b71cad49c8c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2065
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-29 08:04:43 +00:00
Paul Fertser 8b1fabd8e0 Add xscale debug helper sources and everything related to dist
GPL requires providing sources for any derived work. I do not see any
reason to not include the xscale stuff into release tarballs.

Wildcard matching is used because plain directory name matches
implicit rule for executables and xscale.c built is errorneously
attempted, and directory name with a slash duplicates a directory
(xscale/xscale) in dist.

Change-Id: Ie0266470dcb97be87a09ba2dda9b3957f7cbc2fa
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1911
Tested-by: jenkins
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:56:33 +00:00
Paul Fertser 7301bf1a67 Add usb_blaster cheap clone notes to dist
Change-Id: Ie9569634415ef76e88d5ca58bae6184838cf7114
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1908
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:56:13 +00:00
Paul Fertser 7a16340343 Add rlink speed table sources and everything related to dist
GPL requires providing sources for any derived work. I do not see any
reason to not include the rlink stuff into release tarballs.

Change-Id: I686ab88994030312aca5bdfe731a72f10803b5c3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1907
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:55:50 +00:00
Paul Fertser 18bbffb6f7 Move ocl (at91sam7x flash loader) sources to contrib
Change-Id: Ib5c3c505a067d0e285a7b074cb6fddebfa6dda1e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1904
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:55:34 +00:00
Spencer Oliver e483959a29 armv7m: remove magic numbers for number of core registers
Change-Id: I4296b812f0211011ccf3da8d203545dfba493903
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2053
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:47:48 +00:00
Spencer Oliver 27b073a941 rtos: fix xml register support regression
Seems that when xml register support was added the rtos code was not
updated to match. This then caused gdb to return the following error when
rtos support was enabled - "Remote 'g' packet reply is too long".

Change-Id: I7429c4b1efed120e2e690678d55f3d6e87ee1ff1
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2054
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:34:36 +00:00
Andrey Smirnov f7ffd142ee nrf51: Fix incorrect flash writing sequence
nRF51 doesn't have any sort of flash page cache so we need to write
all of the data on the word-by-word basis and poll for "Flash Ready"
bit each time.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Change-Id: I8caffbf69ebf9a69915724704ddbe270d1bb8d92
Reviewed-on: http://openocd.zylin.com/2050
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:33:30 +00:00
Andrey Smirnov b9cb2027b3 nrf51: Remove unnecessary explicit type casting
Change-Id: I523e81645434760649ea2c00e6f80c2b08d08d94
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2055
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:31:27 +00:00
Andrey Smirnov ba66b4c594 nrf51: Add UICR writing support
SoftDevice stack ihex binary, provided by Nordic expects being able to
write data necessary for its correct operation at the adresses inside UICR.
This patch exposes UICR region of flash as a second bank on the MCU to
facilitate that.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Change-Id: Idbc140b8de027f60655f78043877b7c054eb06f9
Reviewed-on: http://openocd.zylin.com/2013
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:25:21 +00:00
Andrey Smirnov c619f74ca4 nrf51: Add a known devices table and simple chip type detection code
Unfortunately due to my oversight, the original version of the
nrf51_probe function contained useless code that read the contents of
DEVICEID[0] an DEVICEID[1] registers and did nothing about it(those
registers had nothing to do with the device type information anyway).

This commit fixes that code by changing its behavior to read the HWID
field of CONFIGID register and looking up the corresponding device
information in the know devices table. This information is useful
when choosing the versions of SDK and SoftDevice for the chip
using "nRF51822 compatibility matrix".

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Change-Id: Ibd80b35460df4278e86e0c2500b7dcc876eec10c
Reviewed-on: http://openocd.zylin.com/2012
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-29 07:23:02 +00:00
Andrey Smirnov 947a459e18 armv7m: Do not ignore 'value' parameter in armv7m_write_core_reg
Ignoring the value parameter in that function makes its code rather
misleading. Also the only caller of it, armv7m_restore_context already
does the whole "buf_get_u32" conversion business, so using
'value' also removes the waste of doing the conversion twice.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Change-Id: I515979c314d9b59ee1065c55b5bb5747c7e93f01
Reviewed-on: http://openocd.zylin.com/2057
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:18:09 +00:00
Angus Gratton 6f62e2428e AT91SAM4L: Fix bug when writing to flash at a non-zero offset, add debug
output for flash page writes

The offset wasn't being considered in the "full page" write codepath, so any
writes at an offset were actually written out starting from page 0.

Change-Id: I5e70a1f35f144b3edd1ce6d9df9af9b5da6cf194
Signed-off-by: Angus Gratton <gus@projectgus.com>
Reviewed-on: http://openocd.zylin.com/1965
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:15:36 +00:00
Andrey Yurovsky fb897cc805 jlink: add support for Jlink-OB (0x0105) devices
The JLink-OB (onboard) devices work the same way as the normal JLink
except that their PID is 0x0105 (and that's the only one we know of so
far) and their endpoint addresses are different due to there being a
CDC-ACM interface as well.  These JLink-OB devices show up on a lot of
vendors' development kits as an integrated debugger.

This change simply checks whether the adapter we opened has a JLink-OB
PID and, if it does, uses the JLink-OB endpoints rather than the
default.  To do this, we add a new routine, jtag_libusb_get_pid() to the
libusb adapter layer, it in turn just calls
libusb_get_device_descriptor(), which previously had no wrapper.

Also, checkpatch.pl doesn't like the VID/PID macros as defined so I
moved them to the array itself.  This should have no effect on the code.

This change adds the 0102 through 0104 PIDs to openocd.rules as well as this
new 0105 PID.

Tested on an Atmel SAM4S Xplained board which has a JLink-OB, also
regression tested by using a 0x0101 PID normal JLink adapter.

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Change-Id: I121d30e57729cda3adb66e2a5dc72e1fcb7ef8b1
Reviewed-on: http://openocd.zylin.com/2031
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:12:42 +00:00
Andreas Fritiofson a5ef7b83e2 Support for sam3n0a sam3n0b sam3n00a sam3n00b
Change-Id: I70a04f5f9b0b20d42a677ea8781130e44be758d3
Signed-off-by: Stefan Arnold <sarnold@sh-sw.de>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2042
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:12:17 +00:00
Paul Fertser 58256d4835 flash/nor/tcl: fix segfault on write_image misuse
"flash write_image (unlock|erase)" (without filename) was causing
segmentation fault in strcmp(). This patch fixes it.

Change-Id: Ia3b8c796f4107621d78605c02d2b8e123b1b207b
Reported-by: ajkroll][ <ajkroll][@irc.freenode.net>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1970
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 06:55:13 +00:00
Oleksij Rempel d2ddb53f7d mips_ejtag.c: disable DMA for all platforms
DMA seems to be broken in many ways. Don't trust it!

Change-Id: I7e28608f299abdf78d02a967c62849b6b2ce5985
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1936
Tested-by: jenkins
Reviewed-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 06:51:50 +00:00
Andreas Fritiofson 09e9625d6c ft2232: Mark interface driver as deprecated
Change-Id: I5ebc924ab66c86f1902942bebc203a34d97abc64
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1899
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-28 10:07:01 +00:00
Jörg Wunsch d2273d10b6 CMSIS-DAP: print a debug message when the USB product string cannot be read
As suggested by Stian Skjelstad in a comment in:

http://openocd.zylin.com/#/c/2044/

if the USB product string cannot be read, provide a debug message so
users might get aware of a potential permission problem when looking
at the debug output.

Fix style bug found by Jenkins.

Change-Id: I6acb1c6261fec6f2bee80e4be513a5c5e29eff79
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2048
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:49:50 +00:00
Jörg Wunsch 325066149f All Atmel-provided CMSIS-DAP devices use 512 byte packet size
The existing CMSIS-DAP driver matches the USB VID/PID against 0x3eb
(Atmel VID) and 0x2111 (Atmel EDBG embedded CMSIS-DAP debugger), and
then bumps the packet size from its default of 64 to 512.  However, it
turned out that *all* Atmel-provided CMSIS-DAP devices (EDBG with PID
0x2111; JTAGICE3 with firmware version 3.x, PID 0x2140; new Atmel-ICE
[successor of JTAGICE3], PID 0x2141) require a 512-byte packet size.
Obviously, all run the same USB implementation inside their custom
microcontroller.  Thus, it seems best to simply assume that *all*
Atmel CMSIS-DAP devices use this packet size, and don't check the PID
at all.

This has also been filed as Trac bug #68:

https://sourceforge.net/apps/trac/openocd/ticket/68

Change-Id: I942af93060fdf265fca3961841638caa6182f877
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2045
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
2014-03-17 12:49:07 +00:00
Jörg Wunsch 0c7db47e58 Prevent segfault when the USB product string cannot be retrieved
In the CMSIS-DAP driver, if nothing has been specified by the user, an
attempt is made to find the first device with the (mandatory)
substring "CMSIS-DAP" in any USB device's product string.  However,
while (usually) all devices can be traversed, devices the user does
not have permission for cannot be read the product string from,
resulting in a NULL pointer.  Trying to find the substring "CMSIS-DAP"
causes a segementation fault then.

This has also been filed as Trac bug #67:

https://sourceforge.net/apps/trac/openocd/ticket/67

Change-Id: Idfc9f072e34152e9af99fe1c8ec88c99dea4624c
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2044
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:48:29 +00:00
Jens Hoffmann 6bc7ddeffd stm32f2x.c: Add STM32F401xE device id.
Nucleo F401 board uses STM32F401RE chip with new device id and
got more flash than existing devices (512K). This patch adds
new the identifier to probe functions so flashing will now work.

Change-Id: Ibe9c047c79244db0cfbb06610da9d84987b9f85a
Signed-off-by: Jens Hoffmann <jehoffma@gmail.com>
Reviewed-on: http://openocd.zylin.com/2037
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:47:44 +00:00
Andreas Fritiofson 565f8481c7 flash: Constify write buffer
Change-Id: Ic812098d3ed5a2992c26bb57d08ae350e2c5d5d8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2040
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:47:18 +00:00
Andreas Fritiofson cd091c3630 flash/kinetis: Fix bug in odd byte count padding
Change-Id: Ic5cfd880f2b49e3a96c408cf868db622bfe698a1
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2039
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:47:04 +00:00
Andreas Fritiofson b9b872cc44 flash/efm32: Fix bug in odd byte count padding
Change-Id: I7fcd152a8501f399c6ac5a85fd62a84c82b030a0
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2038
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:46:36 +00:00
Andreas Fritiofson 2d73fd8686 target: Don't poll until the target is examined.
The timer callback is started on target init, but it makes no sense to
poll until the target is fully setup.

Change-Id: I118201e125e39be3d0a920e3ef9a3f68a2035f39
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2041
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:46:14 +00:00
Paul Fertser d99efc9076 gdb_server: do not copy feature names for tdesc generation
We always have feature names defined by string literals and the
standard guarantees static storage duration for them. Hence, there's
no need duplicating and then freeing them.

Valgrind-tested.

Change-Id: I1b77f966c548e3694141c63bd8680735f0f47505
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2028
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:42:26 +00:00
Bartosz Bielawski 4c9d6038b2 stlink_usb.c: add support for STLink V2-1
The new version of STLink (V2-1) has a different USB endpoint layout.
As the PID of the device also changed it's possible to change EPs used
by OpenOCD in runtime. The patch adds three new fields to stlink_usb_handle_s
and assigns right EP numbers in stlink_usb_open().
Parts of the code inspired by and used with consent of Jens Hoffmann.

Change-Id: I93b69fb889f15317e9bf864905f435905db39745
Signed-off-by: Bartosz Bielawski <bartosz.bielawski@gmail.com>
Reviewed-on: http://openocd.zylin.com/2019
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:41:57 +00:00
Andreas Fritiofson 17fddb4289 stlink: Use callback to increase frequency of trace data sampling
The ST-LINK/V2 has limited internal buffering, such that trace data
can be missed if the target is generating data at a rate quicker than
the OpenOCD trace sampling. The issue of lost data is compounded since
individual TPIU packets may be split across individual STLINK_TRACE_EP
reads, and misleading results can occur if mid-packet loss occurs.

This patch increases the frequency of checking for pending trace data
with the aim of minimising such losses. Note: With the limited (I/O
and memory) bandwidth of the ST-LINK/V2 there cannot, however, be a
guarantee against trace data loss.

The timer callback is only added when enabling tracing, and is removed
when tracing is disabled.

Change-Id: Ibde9794b77793d3068f88cb5c1a26f9ceadcbd8a
Signed-off-by: James G. Smith <jsmith@ecoscentric.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1661
Tested-by: jenkins
2014-03-07 21:19:12 +00:00
Andrey Smirnov d82490adfb nrf51: Fix format string bugs in nrf51_info
Additional information string appended to the 'flash info' output used
incorrect offsets and was missing a couple of fields.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Change-Id: If131be021295cab6adfca7da03c2f0fb8dca7d42
Reviewed-on: http://openocd.zylin.com/2011
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-07 20:04:54 +00:00
Kamal Dasu 7e1dfcbe2d cortex_a: Fix endianess issues in cortex_a8_*_apb_ab_memory
Make the APB-AB memory read routines handle endianess order
when running on big endian host. cortex_a8_read_apb_ab_memory
is also called by cortex_a8_write_apb_ab_memory and was breaking
both APB-AB read and write functions. Also fixed bug in write
function in calculating the offset of end of buffer data. The
change aslo fixes the read issues with all combinations of
aligned unaligned memory access found by 'test_mem_access' cmd.

Tested with target "test_mem_access 4000", also size 1-9,
'mdb/h/w' 'mwb/h/w' cmds and equivalent gdb 'x' 'set' cmds.

Change-Id: Ia927c60c4837617f5342a9beb6fdab1f061855fe
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-on: http://openocd.zylin.com/1781
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2014-03-07 18:53:35 +00:00