aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2015-09-05server: tcl_trace commandAustin Morton4-11/+140
Implements async target trace output to the tcl server Change-Id: I0178f6404447337d523782a1d2c317457030da40 Signed-off-by: Austin Morton <austinpmorton@gmail.com> Reviewed-on: http://openocd.zylin.com/2588 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-08-19flash/nor/jtagspi: 'retval' may be used uninitializedAlamy Liu1-1/+1
Problem As my compiler has "warnings being treated as errors" on, it shows the error message: error: 'retval' may be used uninitialized in this function Investigation Nothing wrong with the logic, 'retval' would have a value before returning. Just wanna get rid of the compiling "warning as error" message. Solution Provide a reasonable default value Change-Id: I712c15f82819c6c48bee9dceca8de4b18aeb29b0 Signed-off-by: Alamy Liu <alamy.liu@gmail.com> Reviewed-on: http://openocd.zylin.com/2905 Tested-by: jenkins Reviewed-by: Robert Jordens <jordens@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-08-06svf: flush the queue before reallocing memoryPaul Fertser1-0/+4
During reallocation a new memory region might be allocated and the old one freed. If jtag queue is holding a pointer to the old memory, it will segfault during the execution. Avoid this by flushing the queue before a reallocation attempt is made. This should fix ticket #102. Change-Id: I737fc3f1ebf6d76413a475beb8bf20184fe0233f Reported-by: Alex Forencich <aforencich@users.sf.net> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2899 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-08-06flash : Add support for Atmel at91sam4sa16bEvan Hunter1-0/+33
Change-Id: Ief6833b4bf587fbf53c8fbeee2fc276a95ca0a8a Signed-off-by: Evan Hunter <ehunter@broadcom.com> Reviewed-on: http://openocd.zylin.com/2878 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06gdb_server: Add check for malloc failEvan Hunter1-0/+3
Change-Id: I623b30883042eae3253ed29de5c426da760dffa0 Signed-off-by: Evan Hunter <ehunter@broadcom.com> Reviewed-on: http://openocd.zylin.com/2871 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06bcm2835gpio: Add SWD support, Raspberry Pi 2 support.Christoph Pittracher1-9/+158
Added support for SWD transport similar to sysfsgpio driver. Added configurable peripheral base address to support Raspberry Pi 2. Change-Id: If76d45fbe74ce49f1f22af72e5f246e973237e04 Signed-off-by: Christoph Pittracher <pitt@segfault.info> Reviewed-on: http://openocd.zylin.com/2802 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06at91samd: add chip IDs for SAMC20 and SAMC21 familiesAndrey Yurovsky1-0/+37
Add the chip IDs corresponding to the new 5V "SAMC" parts which are otherwise identical to the SAMD and should work with this driver. Also add the configurations for their Xplained Pro boards. Change-Id: Ic268d4ac384a3a77d4211a94da9f9faf4d8c0f7b Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2809 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06sim3x: fix build failure with clang 3.6Paul Fertser1-7/+5
This fixes a warning as reported by the current clang version: ../../../../src/flash/nor/sim3x.c:867:20: error: address of array 'sim3x_info->device_package' will always evaluate to 'true' . Change-Id: Ie160cbe6df8f491e9beff38d47e2f13575529bf9 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2838 Tested-by: jenkins Reviewed-by: Oleksij Rempel Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06flash/nor/jtagspi: add JTAGSPI driverRobert Jordens3-0/+414
Many FPGA board speak JTAG and have a SPI flash for their bitstream attached to them. The SPI flash is programmed by first uploading a proxy bitstream to the FPGA that connects the JTAG interface to the SPI interface if the IR contains a certain USER instruction. Then the SPI flash can be erase, written, read directly through the JTAG DR. The JTAG and SPI signaling is compatible. Such a proxy bitstream only needs to connect TDO-MISO, TDI-MOSI, TCK-CLK, and the activate the chip select when the IR contains the special instruction and the JTAG state machine is in the DR-SHIFT state. Change-Id: Ibc21d793a83b36fa37e2704966aa5c837c4dd0d2 Signed-off-by: Robert Jordens <jordens@gmail.com> Reviewed-on: http://openocd.zylin.com/2844 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06flash/nor/tcl: add read_bank and verify_bankRobert Jordens1-0/+177
The only read access to flash chips so is through the target's memory. Flashes like jtagspi do not expose a memory mapped interface to the flash. These commands use the flash_driver_read() driver API directly. Change-Id: I40b910de650114a3f676507f9f059a234377d862 Signed-off-by: Robert Jordens <jordens@gmail.com> Reviewed-on: http://openocd.zylin.com/2842 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06cpld/virtex2: allow JSTART to be disabledRobert Jordens2-5/+12
This adds an option to disable the use of the JSTART instruction when loading bitstreams to xilinx fpgas. JSTART apparently prevents configuration if the startup clock is not set to the jtag clock in the bitstream. xc3sprog is omitting JSTART for all devices. Problems with loading a bitstream that does not have StartupClk:JTAGClk are described here: http://www.xilinx.com/support/answers/56151.html Change-Id: I8137c0bae05a8c3c6f8e2611869f70a770d1651d Signed-off-by: Robert Jordens <jordens@gmail.com> Reviewed-on: http://openocd.zylin.com/2860 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06flash/nor/spi: add micron/numonyx n25q128Robert Jordens1-0/+1
http://www.micron.com/products/nor-flash/serial-nor-flash https://www.micron.com/~/media/documents/products/data-sheet/nor-flash/serial-nor/n25q/n25q_128mb_3v_65nm.pdf Signed-off-by: Robert Jordens <jordens@gmail.com> Change-Id: Icfb830387fabfb1a67e4d00bdf21a10420f6fc1c Signed-off-by: Robert Jordens <jordens@gmail.com> Reviewed-on: http://openocd.zylin.com/2841 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06target/testee: manage target->stateRobert Jordens1-0/+5
The testee target is usefull for certain non-cpu pass-through situations, for example in the case of a spi flash mapped to the DR of a JTAG tap, as is the case for most FPGAs with SPI flashs behind them. We just manage the RUNNING/RESET/HALTED state in the testee driver to support it being halted which is a requirement for flash banks. Change-Id: I1b4d52c58a1f6bd753e126bfde74dcc5164d7b69 Signed-off-by: Robert Jordens <jordens@gmail.com> Reviewed-on: http://openocd.zylin.com/2840 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06jlink: Add on-board nRF51-DK USB VID and PIDKyle Manna1-2/+2
* Add USB VID and PID for the J-Link interface running on the Nordic Semiconductor nRF51-DK. Also tested with debug out port to debug external boards. * Elimiantes need for `-c "jlink pid 0x1015"` on the openocd cmd line. Change-Id: Ib23acb72b9f5183b76fc7dc22b556982869ae830 Signed-off-by: Kyle Manna <kyle@kylemanna.com> Reviewed-on: http://openocd.zylin.com/2775 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06RTOS: ThreadX support on ARM926E-JSAlexander Drozdov1-2/+160
ThreadX uses two stacking schemas on ARM926E-JS, extend API to use more then one stecking at time. Change-Id: I92d445ad0981b6409ea4c4e7e438d3a7ae39cbe7 Signed-off-by: Alexander Drozdov <adrozdoff@gmail.com> Reviewed-on: http://openocd.zylin.com/2848 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-08-06target: check memory handlers before use for all typesKarl Palsson1-24/+16
MMU types were checking and installing fakes at init, but this wasn't catching all devices. Fixes segfaults when attempting mdw and friends on avr. Change-Id: I5b11f9913157a21f1aeb11ec852f593b529d9be8 Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/2791 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Andreas Färber <afaerber@suse.de>
2015-05-17jtag/drivers/stlink: fix SRST issue with stlink-v1Paul Fertser1-1/+1
Even though the latest firmware version for stlink-v1 supports "v2" JTAG API, the hardware SRST handling is still broken; amend the check accordingly. Change-Id: I62c662cd7aa209d2d6e9fe260f5c0be81d0ce672 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2761 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-05-17psoc4: add support for Cypress CCG1 familyVincent Palatin1-0/+9
Add the identifiers to support the flash on the Cypress Type-C Port Controller chips of the CCG1 family : http://www.cypress.com/ccg1/. Tested successfully on CYPD1132-16SXI. Change-Id: I3fe6283379e5bcab964afac31b547ef95535aa2c Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: http://openocd.zylin.com/2757 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-05-17nrf51: refine and extend known devices tablePeter A. Bigot1-16/+34
The notation Gx0 in the nRF51 Series Compatibility Matrix indicates that the specified HWID is valid only for build code 0 of each chip, and for subsequent builds the HWID will be different. Replace the Gx0 notation with G0 throughout, and add the missing HWID for nRF51422 QFAC A1 (present on the newer nRF51 developer boards). See: https://www.nordicsemi.com/eng/nordic/download_resource/41917/5/55913589 See: https://devzone.nordicsemi.com/question/30774/mapping-hwid-to-revision-information/ Change-Id: I79d842137d41342db35904867c48b06fbc6fbc70 Signed-off-by: Peter A. Bigot <pab@pabigot.com> Signed-off-by: Angus Gratton <gus@projectgus.com> Reviewed-on: http://openocd.zylin.com/2593 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-05-17server: avoid the tcl server crashing when there is no targetAustin Morton3-2/+3
Since commit 1d0cf0df37a4e831ca3121ba8987d5848cad3e42 ("server: tcl_notifications command") connecting to the tcl server would terminate openocd. Fix this. Change-Id: I36e2a7482f7db3a30ff7e9f969c3b6cda9599382 Signed-off-by: Austin Morton <austinpmorton@gmail.com> Reviewed-on: http://openocd.zylin.com/2759 Tested-by: jenkins Reviewed-by: Forest Crossman <cyrozap@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-24jtag/drivers/ti_icdi: do not segfault when adapter can't be openedPaul Fertser1-0/+3
Change-Id: Id3af8dfd18b13947bca4f3c89c2516ccbcef60b6 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2742 Tested-by: jenkins
2015-04-24rtos/mqx: prevent crash with -rtos autoPaul Fertser1-0/+6
Since mqx comes last in the list, with the auto option its update_threads is called even though it wasn't detected. This check should be removed from all the rtos helpers and moved to the generic code, but better do it later all in one go. Change-Id: If24ab42a58a468d90e9f12028d4c2fb76a9bc2e8 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2741 Tested-by: jenkins
2015-04-24target/cortex_a: examination should be done every time it's asked forPaul Fertser1-3/+3
It was observed on AM437x that after every reset the target's debug regions are unpowered. To be able to properly communicate with the target and perform cortex_a init debug access after a reset event the examination need to be performed every time, not just on OpenOCD start. Change-Id: Idf272e127ee88341e806ee00df154eade573451d Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2723 Tested-by: jenkins Reviewed-by: Felipe Balbi <balbi@ti.com>
2015-04-24target: try to reexamine even when polling failsPaul Fertser1-6/+4
After intermittent connection failures or target power failures it might be necessary to try reexamination even when polling fails. This should make communication with Cortex-A targets more reliable. This was runtime tested with stlink attached to an stm32l1 and an FTDI JTAG adapter attached to an stm32f1 target. Change-Id: I38c4db8124b7f4bbf53ddda53c13273449f49c15 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2721 Tested-by: jenkins Reviewed-by: Felipe Balbi <balbi@ti.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Andreas Färber <afaerber@suse.de>
2015-04-24rtos: fix print format specifiersPaul Fertser2-5/+6
Exposed by arm-none-eabi build. Change-Id: I657c642249aa83403f93132d1e28713aee692c30 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2724 Tested-by: jenkins
2015-04-16configure the SWD frequency when setting adapter speed in SWD mode for versaloonSimon Qian1-1/+3
Change-Id: I99cdc11ba1442e4c9efaa0f1de8e7089ec725e14 Signed-off-by: Simon Qian <openocd@versaloon.com> Reviewed-on: http://openocd.zylin.com/2608 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-04-16flash: at91samd: add SAML21 support, fix part ID issueAndrey Yurovsky1-2/+18
This adds support for the new Atmel SAML21 family of low-power Cortex M0+ devices. Their Flash controller is essentially the SAMDxx one so the change consists of adding the new part IDs. Unfortunately the device ID logic had a couple of mistakes in it that did not affect anything on SAMD2x devices (due to 0 values expected there) but that is a problem on L21, it's therefore addressed here and things should now match the datasheets. Tested on Amtel SAML21 Xplained Pro development kit against the included SAML21J18A there. Also tested for regressions on a SAMD20 and SAMD21 using their dev kits. Change-Id: I768f75e064b8656c15148730dacaa4c3acfc4101 Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2690 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-16stlink_usb.c: Decode some more errors.Uwe Bonnes1-0/+8
Change-Id: I637cb63bd39120554aa184eaa48fd00a4852359f Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2706 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-04-16flash/nor/mdr: add docs, remove memory leak on probe()Paul Fertser1-0/+7
This adds the mandatory Info documentation for the driver as well as the usage field. As a clean up, this also includes freeing of the allocated memory which results in a memory leak if probe is invoked multiple times. Valgrind-tested. Reported by Dmitry Shpak. Change-Id: I2b1d9b9e8b069c6665b11d880b40ce19a1b26ce6 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2694 Tested-by: jenkins Reviewed-by: Дмитрий Шпак <disona@yandex.ru> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-04-16flash: efm32: Add support for EZR32LG and EZR32WG.Marc Schink1-3/+19
This patch was tested with an EZR32WG Starter Kit. Change-Id: I0f7c619e715fe30e88e6da3bead0806dd3bce819 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2700 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-04-16docs: update OpenOCD url's to openocd.org domainSpencer Oliver1-1/+1
Change-Id: I8b55c8d12773a1c36f2fd2afeecf20a74e890064 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2698 Tested-by: jenkins
2015-04-16cmsis-dap: print vendor and product id on open failureSpencer Oliver1-1/+1
Change-Id: Iae7ed8d59a722b805536550a8033f5fb7c85c5fc Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2708 Tested-by: jenkins Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
2015-04-16Fix several format specifiers errors exposed by arm-none-eabiPaul Fertser8-15/+15
Change-Id: I1fe5c5c0b22cc23deedcf13ad5183c957551a1b7 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2719 Tested-by: jenkins
2015-04-16rtos: add instructions and helper code to make FreeRTOS work againAndreas Fritiofson1-1/+5
Run-time tested with FreeRTOS V8.1.2 (current version). For the time being I propose this way of dealing with RTOSes that do not export necessary information on their own. I also suggest implementing a similar scheme for ChibiOS, exporting the necessary struct fields' offsets via an OpenOCD-specific helper. Change-Id: Iacf8b88004d62206215fe80011fd7592438446a3 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2347 Tested-by: jenkins
2015-04-16FreeRTOS: Make optional symbols optionalAndreas Fritiofson1-15/+22
xSuspendedTaskList and xTasksWaitingTermination are only available for some configurations. Missing optional symbols will have their addresses remaining at zero so the corresponding lists will be skipped when building the task list. Change-Id: If330f5038d009298c3a14a4d2756db7105a30bc8 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2425 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-14AT91SAM4L: handle reset run/halt in SMAPTomas Vanek1-7/+43
This is a remake of http://openocd.zylin.com/1966 originally written by Angus Gratton <gus@projectgus.com> ATSAM4L has a "System Manager Access Port" (SMAP) that holds the CPU in reset if TCK is low when srst (RESET_N) is deasserted. Without this change any use of sysresetreq or srst locks the chip in reset state until power is cycled. A new function smap_reset_deassert is called as reset-deassert-post event handler. It optionally prepares reset vector catch and SMAP reset is released then. Change-Id: Iad736357b0f551725befa2b9e00f3bc54504f3d8 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/2604 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-14target/arm_adi_v5, cortex_m: retry ahbap_debugport_init few times in case of ↵Paul Fertser2-51/+68
an error Some targets need arbitrary amount of time (usually not too long) after reset (both sysresetreq and srst) to do initialisation, and SWD/JTAG is not available during that. According to PSoC4 docs, the debugger should try connecting until it succeeds. Also ahbap_debugport_init might be necessary to perform after using hardware srst too, so add it there (except for the targets that support srst_nogate since they are very unlikely to need it). Change-Id: I3598d5ff7b8e0bf3a5566a57dec4b0b2b243d297 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2601 Tested-by: jenkins
2015-04-14target/cortex_a: emit a clear error message when dbgbase can't be detectedPaul Fertser1-1/+4
In some cases (the most obvious are TI's SoCs) ROM table lacks entries for the cores, so OpenOCD has no way to determine what debug base to use. Due to an error fixed in ec9ccaa28849 it wasn't handled properly, and OpenOCD would continue to try using dbgbase = 0, which happened to work for e.g. AM437x. This patch adds a clear indication to the user that to access such a target, dbgbase must be set manually in the config. Reported by Felipe Balbi on IRC. Change-Id: Id8533e708f44b76550eb8b659564f5f45717c298 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2603 Tested-by: jenkins
2015-04-14flash/nor/lpc2000: free allocated working area when target_write failsPaul Fertser1-1/+3
In some circumstances (e.g. inappropriate jtag clock) target_write_memory in lpc2000_iap_working_area_init might fail. The allocated working area should be freed inside lpc2000_iap_working_area_init in this error case. This was leading to a weird segfault due to stack corruption later when reset was executed. Reported by quitte (Jonas Meyer). Change-Id: Ia2ed42a9970a4d771727fd516a6eea88e9b859e2 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2696 Tested-by: jenkins
2015-04-14jtag/adi_v5_jtag: fix infinite recursion in jtagdp_transaction_endcheck()Paul Fertser1-3/+2
Calling ahbap_debugport_init() is wrong here because the actions performed by it might lead to jtagdp_transaction_endcheck errors thus leading to infinite recursion. The removed code is not needed now because target polling should lead to reexamination automatically, and both cortex_a and cortex_m call ahbap_debugport_init() as part of their target examine handler. This was reported as a real life issue on IRC by Weaselweb with Cortex-A target. Quitte reports similar results in some circumstances (adapter_khz too high) with LPC17xx. Change-Id: I7148022f76a1272b5262d251f2e807ffb1543547 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2697 Tested-by: jenkins
2015-04-14flash/nor/lpc2000: properly free working area used in get_lpc2000_part_id()Paul Fertser1-0/+3
The IAP working area needs to be freed here, just like in all the other driver functions since an automatic local variable is used to store a pointer to it. This was reported by quitte (Jonas Meyer) on IRC as a strange totally unrelated segfault after doing certain operations (leading to target reset) from GDB. He has provided me with remote access to the specific machine and configuration that exposed the issue, and after some debugging it became apparent that a auto local variable (holding the gdb connection pointer) gets overwritten somehow. Placing an appropriate breakpoint just before the event and using a watchpoint made the cause apparent: reset lead to freeing of all working areas, and there was one holding a pointer to a variable that was auto local in get_lpc2000_part_id(). Change-Id: I7e634d890135ca0f3b4b311e09e8385a03982bd6 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2695 Tested-by: jenkins
2015-04-14jtag/startup.tcl: fix regression with autoselecting JTAGPaul Fertser1-3/+2
This regression was introduced with d90b86d8. "transport select" doesn't throw an error anymore and autoselects the first available transport on its own. Reported by moyix on IRC. Change-Id: I3f303c0372e915931cca4b28af450694abc1a63e Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2693 Tested-by: jenkins
2015-04-14ChibiOS: fix crash on auto detectionRichard Braun1-1/+6
The detection framework assumes rtos->symbols is dynamically allocated, an assumption that the ChibiOS variant breaks by providing a raw statically allocated symbol list. Change-Id: I379bcc2af99006912608ddd3f646ff7085606f47 Signed-off-by: Richard Braun <rbraun@sceen.net> Reviewed-on: http://openocd.zylin.com/2597 Tested-by: jenkins Reviewed-by: Stian Skjelstad <stian@nixia.no> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-14Tcl exception codes cleanup, shutdown command amendmentsPaul Fertser5-28/+44
This patch might influence openocd Tcl commands behaviour in subtle ways, please give it a nice testing. The idea is that if an OpenOCD Tcl command returns an error, an exception is raised, and then the return code is propogated all the way up (or to the "catch" if present). This allows to detect "shutdown" which is not actually an error but has to raise an exception to stop execution of the commands that follow it in the script. openocd_thread special-cases shutdown because it should then terminate OpenOCD with a success error code, unless shutdown was called with an optional "error" argument which means terminate with a non-zero exit code. Change-Id: I7b6fa8a2e24c947dc45d8def0008b4b007c478b3 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2600 Tested-by: jenkins Reviewed-by: Juha Niskanen <juha.niskanen@haltian.com> Reviewed-by: Jens Bauer <jens@gpio.dk> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2015-04-14helper: shutdown command should return with 0 exit statusJuha Niskanen1-1/+4
Commit a35712a85c42 caused a regression where command openocd -c "echo a1; shutdown; echo a2" always returned non-zero exit status to operating system, even when commands before shutdown all succeeded. This patch attempt to fix this. Change-Id: I3f478c2c51d100af810ea0171d2fd4c8fcc657f3 Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com> Reviewed-on: http://openocd.zylin.com/2589 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-14jtag/tcl: fix incorrect memcpy in jim_newtap_expected_idPaul Fertser1-10/+5
Found by clang static checker. On the very first call of jim_newtap_expected_id() pTap->expected_ids and expected_len are null, and there's nothing to copy. This patch changes this cryptic code to use realloc() instead. Change-Id: Ic0b5140d08257a906f15b55a2ae64db7bc06d5f1 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2562 Reviewed-by: Stian Skjelstad <stian@nixia.no> Tested-by: jenkins
2015-04-14lpc2000: Removed cmd51_can_xxxxb variables.Nemui Trinomius1-34/+1
Current flash driver can fail to write across the sector boundary. This patch fixes "thisrun_bytes" set to "cmd51_dst_boundary" value instead of "cmd51_can_xxxxb" Referred to SevenW's post and fix,thanks. http://sourceforge.net/p/openocd/mailman/openocd-devel/thread/fa32e7d6654df22470dc5f4a3dbc984a%40familiebenschop.nl/#msg33594152 Tested on below listed chips. LPC810,LPC811,LPC812,LPC824,LPC1115,LPC1343,LPC1347,LPC1227, LPC1769,LPC1788,LPC54102,LPC4088 and LPC2388. Change-Id: If1c6a1daa58ca27c405bd959a784e599a7a8f4d4 Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Reviewed-on: http://openocd.zylin.com/2607 Tested-by: jenkins Reviewed-by: Jens Bauer <jens@gpio.dk> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-14Added Atmel SAM4SA16C chip (chip ID 0x28a70ce0).Patrick Noffke1-0/+44
Change-Id: I45e8e807a36c39940b910b3edb40698c7d8dabd6 Signed-off-by: Patrick Noffke <patrick@noffke.me> Reviewed-on: http://openocd.zylin.com/2625 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-04-14startup: Fixed measure_clk to return kHz instead of MHz.Ed Beroset1-2/+3
The original code had iterated 10,000,000 times and taken the elapsed time divided by 10,000, to yield kHz which is mathematically correct only if we were measuring time in seconds, but we are measuring time in milliseconds, so the correct divisor is actually 10,000,000. Previous code would report 0.500 for actual measured speed of 500 kHz. Change-Id: Iba4c4961fe3973e7ccfa6dfa11d606a966ceb50c Signed-off-by: Ed Beroset <beroset@ieee.org> Reviewed-on: http://openocd.zylin.com/2573 Tested-by: jenkins Reviewed-by: Jens Bauer <jens@gpio.dk> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-04-14Cortex-A: Don't flush the data/unified cache if MMU is offUwe Kleine-König1-7/+7
When the SCTLR has C set but M unset (i.e. Caching on, but MMU off) the cache if effectively off. So only flush the cache if MMU is on, otherwise stale entries might be committed to memory. Change-Id: Iaff8b6f25b7a41ba838b91d45684c98f99fc0b27 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-on: http://openocd.zylin.com/2429 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Vladimir Svoboda <ze.vlad@gmail.com>