aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-12-11flash/nor: update CC26xx/CC13xx supportEdward Fewell
Added fixes found in additional code reviews. Remove inappropriate use of bank_number field and updated documentation to reflect the change. Restored functionality to cc2538.cfg file because previous change removed the cc26xx.cfg file because the flash support changes made it obsolete. Rolled the previous cc26xx.cfg file into cc2538.cfg and updated it to work with other recent changes. Tested using a SmartRF06 Evaluation board with embedded XDS100v3 and external XDs110. Change-Id: Ia19d00cf8055c5c0f1acc53aa23fd06a80fd2ebc Signed-off-by: Edward Fewell <efewell@ti.com> Reviewed-on: http://openocd.zylin.com/4787 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-12-11jtag: sysfsgpio: clean up swd gpiosReto Schneider
All SWD GPIOs should be un-exported when no longer needed, not just srst. Change-Id: I998377afe43b72446cab3da2d4406fc2912ff8c3 Signed-off-by: Reto Schneider <code@reto-schneider.ch> Reviewed-on: http://openocd.zylin.com/4784 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-12-11helper/log: remove dead code in log_forward()Antonio Borneo
Commit f1be0e6af2e204805a8bc2e8cadf828b9fa46c98 ("HELPER/LOG: review unused symbols") removed a set of unused functions and, as consequence, there is no code anymore that sets the variable "log_forward_count". But, the commit above did not removed the code (now dead) that depends on "log_forward_count" set. Remove the code dependant on "log_forward_count" set and the variable itself. Change-Id: I6efe93d1dccbe13c409c5bc55ba47a2684c0e3ac Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4779 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-11jtag: cmsis-dap: developer tool - enter a command by hex nuberTomas Vanek
Handy to test vendor commands in a CMSIS-DAP adapter. Change-Id: Ieeaa276edf770b1a3076a186e9056b4e5180362a Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3103 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06doc: add ARMv6-M info regarding TAP DeclarationSpencer Oliver
Change-Id: I89095fd0c830fdc2ce40e5d23f8af98502b0ff50 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/4782 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2018-12-06doc: fix some typo about STMicroelectronics nameAntonio Borneo
s/ST/STMicroelectronics/ s/ST Micro/STMicroelectronics/ s/ST Microelectronics/STMicroelectronics/ Change-Id: I62aef331d172db22a70841a089c1889e37997cde Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4718 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add support for STLINK-V3Antonio Borneo
Extend the driver to include the minimal functionality to support the HLA model. Due to the small change in the name (ST-LINK/V2 => STLINK-V3), fix the existing names in the comments in udev rules. Change-Id: Ied33e38063a6da81d9bf249ed195444d7cdf4f03 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4717 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: fix printed version for new STM8 nucleo boardAntonio Borneo
The ST-LINK/V2.1 embedded in the new nucleo boards for STM8 does not follow the normal versioning rules, and puts mass-storage and swim version in the field normally used respectively for jtag and mass-storage version. Apply the check suggested by STMicroelectronics to discriminate the two cases and print the correct version. Change-Id: I0dd1da11013be3f1e56084489e28cfba98bb07af Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4716 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: dump version in the same format of ST firmware upgrade toolAntonio Borneo
This should help comparing the versions before deciding for a firmware update. Change-Id: I7012a60587587539b2fd1a5f9c3b1ce72877793f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4715 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_GETLASTRWSTATUS2Antonio Borneo
Starting from stlink V2J15 the API STLINK_DEBUG_APIV2_GETLASTRWSTATUS is obsoleted and replaced by the new API STLINK_DEBUG_APIV2_GETLASTRWSTATUS2. Manage the two cases to be prepared for an eventual future removal of the obsolete API. Change-Id: Ic4498a652865b2eb6148825138c2f6855a06ba47 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4714 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: remove reset pulse when entering in JTAGAntonio Borneo
Until version J14 the behaviour of ST-Link was to send a reset pulse to the target when the debug connection is started in JTAG mode. No reset pulse is sent, instead, in SWD mode. Version J15 introduces a new parameter to avoid the reset pulse in JTAG mode, aligning the behaviour with SWD. This reset from the ST-Link, if propagated to the target, prevents attaching a running target. Actually this reset pulse is very short (few microsecond) and can be easily filtered out by an on-board capacitor, usually present on the reset wire (mainly to filter the bounces of the reset button). Moreover, most of the use cases for ST-Link are with SWD (not with JTAG) and this has probably further masked this JTAG specific behaviour. OpenOCD can tolerate it but requires the flag "connect_assert_srst" to the command "reset_config", but the flag is not present in any configurations in folder tcl. This enforces the guess it was not noticed due to on-board capacitors or missing connection of reset pin or ST-Link only used in SWD; so it's safe applying this patch. Change the default behaviour to avoid reset in JTAG at connection. There is no need to manage the ST-Link version here, since every parameter that is not recognized by older ST-Link is treated as "connect in JTAG with reset pulse", keeping backward compatibility. Change-Id: Idc97a1457279e3970fd0839cadbff22d9b0302d4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4713 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: simplify api version handlingAntonio Borneo
The API version is hardcoded in the STLINK device and depends on the specific firmware version. There is no way to switch between different API. Thus, it make no sense to keep in two separate variables the current and the max API supported because they are always equal to "the only" API supported by the specific STLINK. Collapse h->version.jtag_api_max and h->jtag_api in a single variable h->version.jtag_api Remove an extra print of api version; this is already advertised while printing the STLINK version. Change-Id: I0519694a34748e5a0aa330932c1256080a6d5f20 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4712 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_MEM_16BITAntonio Borneo
Change-Id: I51a160a105342ddbab99c4182d89650a436f5945 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4711 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_JTAG_SET_FREQAntonio Borneo
Change-Id: I591543f218c6bb30aaeb6321ba8a9425a2b5b6e2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4710 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_SWD_SET_FREQAntonio Borneo
Change-Id: Ibba786c7e18bf15a04b85a2071c79f631a252ccf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4709 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_TARGET_VOLTAntonio Borneo
Use an alias to STLINK_F_HAS_TRACE, both are added in the same version Change-Id: Iabf2fdac407f5c4737c3da942323d60ee50c3470 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4708 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_TRACEAntonio Borneo
Fix the condition for ST-Link/V1; it does not support trace. Trace is added on ST-Link/V2 and ST-Link/V2.1 only. Change-Id: I17416edd05a2c8ece605560b7533edac4f982cfc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4707 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: simplify maintenance of version and featuresAntonio Borneo
The number of stlink firmware version is growing, each carrying new features. Today's code has several check distributed here and there and it's already hard to track them and verify the correctness. The introduction of STLINK-V3 will make the situation much worst, and the code much less readable. Add a "flags" bitmask in the struct stlink_usb_version to allow setting individual bits for each feature available or for specific quirks and workarounds. This patch does not implement setting nor testing "flags"; it would be introduced in following patches, one bit at a time. Change-Id: I09d78202646a6c8330731f8aa96dc9d295fa5655 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4706 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: check for SWD supportAntonio Borneo
The old ST-Link/V1 can either run an obsolete firmware with API_V1 or a more recent firmware (from V1J11 to last V1J13) with API_V2. SWD is only provided by the latter API. Return error is SWD is selected on adapters that does not support it. Change-Id: Iac4ba54d191ba80fb445a7cd3d8c2621dc7a4846 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4705 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add support for 16 bit memory read/writeLaurent LEMELE
Recent stlink version V2J26 introduces support for 16 bit memory read/write. Add the new API and modify the wrappers stlink_usb_{read|write}_mem For older version of stlink keep the same behavior as in current code. While there, fix some minor typo in comments inside the wrappers. This fixes ticket #204 ("st-link can't flash stm32f2x based flash without target algorithms"). Change-Id: Id7d404e588f10a4b0f8a93d7ca44cef8e4c49b4f Author: Laurent LEMELE <laurent.lemele@st.com> Rebased-by: Antonio Borneo <borneo.antonio@gmail.com> Ticket: https://sourceforge.net/p/openocd/tickets/204/ Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4704 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-12-06stlink: add JTAG speed selectionLaurent LEMELE
ST-Link uses two separate API for setting the interface speed in SWD and JTAG. Add the missing API for JTAG and run the proper API depending on the selected mode. Change-Id: I71e955e23c1d82c2ea1c8bfade7612c5a0377a74 Author: Laurent LEMELE <laurent.lemele@st.com> Rebased-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4703 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add usb pid for v2.1 without mass storage deviceAntonio Borneo
New version of ST-Link/V2.1 without mass storage device. From debug point of view, it is compatible with existing ST-Link/V2.1 It uses a new USB PID because the USB endpoints and interfaces are different from usual ST-Link/V2.1 Add the new PID in the driver, in the tcl interface script and in the udev configuration script. Change-Id: Id2e1b5a5d0347c5d951a86a9cdb76be52cfd4ea3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4702 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06flash/stmsmi: fix byte order for big-endian hostAntonio Borneo
The original code was written for and tested on little-endian host only. Rewrite it to be independent by host endianess. Not tested on real HW; I don't own anymore a SPEAr device. Change-Id: I2f427a804693f56cb9dea4936c525eb814c48c28 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4778 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-12-06mem_helper: add mrh commandSteven Stallion
This patch adds support for reading halfword values from memory. This command compliments existing support for writing halfwords (mwh). Change-Id: I8ec628e65c05a7f00aa57e3af0f228eb8bd4d14e Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4781 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2018-12-06jtag: drivers: ft232r: unhardcodedEMARD
FT232R: introducing configurable parameters for pinout, initial buffer size, state of RS232 signals at exit with option to reattach kernel driver. All this was hardcoded before. New parameters are documented in "openocd.texi" file. Allows hopfully self-explainable and user-friendly adaptation to various pinouts and similar chips like FT230X and FT231X. Change-Id: Ib807f2ea3d4c1a164d351d65aeacd1978318d217 Signed-off-by: EMARD <vordah@gmail.com> Reviewed-on: http://openocd.zylin.com/4681 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2018-12-05flash/nor: use default_flash_blank_check() instead of dummyTomas Vanek
Some flash drivers had a dummy method for erase_check. Use default_flash_blank_check() instead if possible. Change-Id: Iddfeff45ce477007328d061fcb5c553d93c3be98 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4766 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com>
2018-11-29SPI table updates (some new devices and new info)Andreas Bolsch
read_cmd, qread_cmd, pprog_cmd added as some recent high densities devices use variants for 4-byte addressing. Some new flash and FRAM device ids added. FRAMs don't have write pages nor erase commands or sector sizes. The corresponding entries are marked as "not used" (i. e. zero). Checks in existing SPI flash drivers added to handle these cases gracefully. Change-Id: I5104bce7c815ac22f98bc32c1bb6db66b984404a Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-on: http://openocd.zylin.com/4773 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-26Set TCP_NODELAY for local connections to jtag_vpi.Darius Rad
This increases performance drematically for local connections, which is the most likely arrangement for a VPI connection. Change-Id: Id15b29ae663f5d8100b2175357649bd03d05b7c8 Signed-off-by: Darius Rad <darius@bluespec.com> Reviewed-on: http://openocd.zylin.com/4549 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-26flash/nor: consolidate flash protect/protect_checkTomas Vanek
Make flash_driver methods protect() and protect_check() optional. Remove dummy definitions of these methods from the drivers which do not implement protection handling. Some drivers did not define protect method. It raised segfault before this change and now it is handled properly. Lot of drivers returned ERROR_OK from dummy protect() - now flash_driver_protect() returns an error if not handled by the driver. Change-Id: I2d4a0da316bf03c6379791b1b1c6198fbf22e66c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4765 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com>
2018-11-26tcl/target, board: remove useless gdb-attach event definitionsTomas Vanek
Since commit bae76053dc515252dc5c8235b9a848e461080c66 gdb-attach event is defined as halt by default. Remove useless and in case of bcm281xx wrong definitions of the event. Change-Id: I8e69780a93722eb9392673303f54d502e71eceb6 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4763 Tested-by: jenkins Reviewed-by: Steven Stallion <sstallion@gmail.com>
2018-11-26stm32l4x: Fix stm32l4x dual bank supportAlex J Lennon
The dual bank option was being incorrectly read and the bank b base incorrectly set. This is tested with 512kB dual bank configuration but needs checking with other configurations (e.g. 256kb). This fix should remove the need to use a mass_erase command prior to programming with OpenOCD Change-Id: I6e920f11b794c4c1fd34c0e44fb8fa01e7fe8f85 Signed-off-by: Alex J Lennon <alex.lennon@s19.tech> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4641 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Thomas Søhus <soehus@gmail.com>
2018-11-20tcl/target: ti_tms570.cfg restructure dap supportTomas Vanek
ti_tms570 was probably omitted in commit 2231da8ec4e7d7ae9b652f3dd1a7104f5a110f3f Change-Id: Idd4828fd5ea3641bda6c73c7f07a598c1e512ef6 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4762 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-11-18efm32: correct erase address if bank->base != 0Andreas Kemnade
Prepare for additional flash banks not located at address 0 Change-Id: I60b78c917f94fa52bf24df9e3315536f776eec84 Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Reviewed-on: http://openocd.zylin.com/4440 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-18target/image: Add support for S6 record in Motorola SREC filesBohdan Tymkiv
S6 record is equivalent to S5 but it uses 24-bit value (instead of 16-bit) to store total number of data records. It can be found in big srec files with total number of data records bigger than 65535 Handle S6 record in the same way as S5 (simply ignore it) Change-Id: I3e15a4e8f784fd38803c00accf422f803e8469cd Signed-off-by: Bohdan Tymkiv <bhdt@cypress.com> Reviewed-on: http://openocd.zylin.com/4645 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-18target/stm32f7x: clarify reset_config commentChristopher Head
The reset_config line in the config file does not actually set connect_assert_srst (the default is connect_deassert_srst), but it reads as if it does. Clarify that the target is compatible with connect_assert_srst, without suggesting that the file actually sets it to that value. Change-Id: I14e9445ab282d386b5d0055f6adf03d7c8878a8c Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4743 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-13Permit null target on TCL connectionChristopher Head
In previous versions of OpenOCD, it was possible to connect to the TCL RPC interface without a current target. In `tcl_new_connection`, the curent target would be queried by number, and the possibility of a null current target was handled properly. In commit bb9d9c60264a905926e0d15f84842858d0de80b7, the `get_target_by_num` call was replaced by a `get_current_target` call, without noticing that `get_current_target` aborts if there is no current target, whereas `tcl_new_connection` is perfectly able to handle that situation. Provide a `get_current_target_or_null` function for use by consumers who are OK with a null current target, and use it in `tcl_new_connection`. Change-Id: I06f7e1e149f1169e23c73ba328c7ad9f9425cc2a Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4730 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
2018-11-10README: fix stlink instructionsPaul Fertser
Since 31c58c139d85c35cc8ebce4196edb2c5eb157c7a there is a unified config for all stlink versions. Change-Id: Id736063496ecd96e2024ed69dcb67a22c44b80bb Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4672 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2018-11-10docs: fix typo in manualSpencer Oliver
Change-Id: I28717105eb2a907b0cb4b03f4b5ff1f47194413b Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/4751 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2018-11-10target/stm32h7x: Fix documentation of reset_configChristopher Head
The stm32h7x.cfg does not specify connect_assert_srst or connect_deassert_srst in its reset_config. The comment claims that it will therefore connect in reset. However, per the manual, the default configuration is actually connect_deassert_srst, not connect_assert_srst. In actual fact, connect_assert_srst does not work on the STM32H7 because, while SRST is asserted, everything on the AXI bus is inaccessible. The CPU core is accessible, but since the examine-end event handler also pokes at the DBGMCU peripheral, that will fail in connect_assert_srst mode. So using connect_deassert_srst is appropriate, so fix the comment accordingly. Change-Id: If3e32e871fb19cc61183bdf911b7c5efd80b62e2 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4741 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-10jtag/bitq: array boundary overflowxuguangxiao
The for loop inside bitq_path_move function is not correct, this will overflow the cmd->path array and produces an unpredictable result. Change-Id: I81e3bc9ee6d1dd948acd2fe4c667103ac22bb26f Signed-off-by: xuguangxiao <szgxxu@qq.com> Reviewed-on: http://openocd.zylin.com/4733 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-08armv7a: ARMv7-A MMU toolsMatthias Welwarsky
factor out mmu-related code from armv7a.c, add a 'dump' command for page tables. Change-Id: Ic1ac3c645d7fd097e9d625c7c8302e7065875dd4 Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/4327 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-11-06target/cortex_a: remove duplicate code to read target registersAntonio Borneo
The functions cortex_a_dap_{read,write}_coreregister_u32() are duplicate of the functions dpm_{read,write}_reg(). Remove both duplicated functions in cortex_a.c while export only dpm_read_reg(), since dpm_write_reg() is currently not used. Rename dpm_read_reg() as arm_dpm_read_reg() to keep uniform the naming style. Change-Id: I501bc99dc402039e630c47917a086a0bb382782c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4747 Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Tested-by: jenkins
2018-11-06target/arm_dpm: uniform names of exported functionsAntonio Borneo
The name of the function dpm_modeswitch() does not follow the common style of the other function names in the same file. Rename it as arm_dpm_modeswitch(). Change-Id: Idebf3c7bbddcd9b3c7b44f8d0dea1e5f7549b0eb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4756 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-11-06target/cortex_a: remove buggy memory AP accessesAntonio Borneo
The armv7m debug port provides a direct access to the CPU memory bus, allowing the debugger to bypass the CPU for every memory operation. The armv7a debug port doesn't offer the same feature, mainly because CPU caches and MMU makes the direct memory access more tricky. Nevertheless most SoC with armv7a provide direct memory access through an AHB bus available on another DAP access port, different from the debug port. The original port of cortex_a in OpenOCD was inspired from the working cortex_m code, and provided optional memory access through the AHB, if present. The code for AHB access is problematic and partially buggy due to incomplete management of cache coherency and missing check of page boundary during virtual address operations. With the commit 5d458cf72734a4474f38bbed10eea4d9acfe93a2 ("target/mem_ap: generic mem-ap target") we have a clean support for memory access through system buses connected to DAP AP, which obsoletes the buggy memory AP hack in cortex_a. Remove any code that uses the memory AP accesses in cortex_a. Change-Id: I7cd1f94885e5817448058953e043d8da90dea3cc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4748 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-11-06target/cortex_a: remove unused code controlled by "fast_reg_read"Antonio Borneo
The variable fast_reg_read is always zero, causing some code to never be executed. Such code try to read the target registers by dumping them in memory and then reading back the memory through the debugger. But it is broken due to lack of cache and MMU management. This code also uses the broken memory_ap access that is going to be removed soon. Remove all the code that depends on fast_reg_read not zero. Add a missing check on arm_dpm_read_current_registers() return. Keep the unused function cortex_a_dap_write_coreregister_u32() to balance the used "read" version. Change-Id: If2ff28a8c49eb0a87dc85207f5431978efd158db Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4746 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-11-03flash/nor/stm32f1x: Use of protection blocks, improved option bytes handlingDominik Peklo
Handle write protection status in blocks instead of sectors, removing unnecessary complexity in the process. Now closer to stm32f2x. Support sequential modification of option bytes by read/modify/write directly to option bytes area instead of always starting with the currently loaded bytes from FLASH_OBR/WRPR registers. Added new command 'options_load' to force re-load of option bytes w/o having to power cycle target. Change-Id: I5c76191e29c17a1e11482df06379d10ca8d6d04d Signed-off-by: Dominik Peklo <dom.peklo@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4576 Tested-by: jenkins Reviewed-by: Jan Vojtěch <honza.vojtech@gmail.com>
2018-11-03arm_adi_v5: do not deactivate power domains while trying to clear sticky errorAntonio Borneo
At OpenOCD start-up the operation of clearing the sticky error in CTRL/STAT register ignores the current value of the power domains bits CDBGPWRUPREQ and CSYSPWRUPREQ in the same register and incorrectly set them to zero. This abrupt disable does not follow the requirement in IHI0031 to wait for the acknowledgment of power disabled before continuing. The power domains are then re-enabled immediately after; it is possible that such short disable period has passed undetected or has been tested only on devices that do not implement the power domains. Anyway, this sequence is incorrect and can generate unexpected and hard-to-debug issues while OpenOCD attaches to a running target that implements power domains. Anticipate the initialization of dap->dp_ctrl_stat and use it while clearing the sticky bit. This has the additional effect of avoiding a power disable in the error recovery part of the function dap_dp_read_atomic(). Keep the same sequence of read/write in dap_dp_init() to avoid breaking the initialization of some problematic target. Add comments to document these choices. Change-Id: I8d6da788f2dd11909792b5d6b69bc90fbe4df25d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4677 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-11-02flash/nor/at91samd: add SAMR21E19A DIDTomas Vanek
While on it correct RAM amount of SAMR21x16A devices Change-Id: Ie9ab9de1551bdceff17af7597a9a2ee41f5aebe0 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4734 Reviewed-by: Eduardo Montoya Tested-by: jenkins
2018-10-31tcl: target: omit apcsw for hlaPaul Fertser
When using stlink for CM7 targets we have to rely on its firmware to do the right thing as direct DAP access is not possible. Change-Id: Ieee69f4eeea5c911f89f060f31ce86ed043bdfd0 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4732 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-10-28drivers/cmsis-dap: speed up sending multiple HID requestsTomas Vanek
The performance of CMSIS-DAP in long data transfers was improved substantially in ef02b69b14d133b061217a91add5a028a77e86bc. But it not as good as some other USB/MCU based adapters. Using HID and therefore interrupt endpoint is slower than USB bulk transfer. CMSIS-DAP adapter implements multiple HID buffer handling and OpenOCD already reads number of buffers from info command. This change adds capability to sumbit more than one HID requests before driver waits for a HID response. This scenario is used for long transfers only. Results show about double speed on USB FS and ~140% speed on USB HS: | w/o this change | with multi HIDrq -----------------------------------------+-----------------+----------------- Open source CMSIS-DAP, USB FS, adapter_khz 1000 dump_image ram32k.bin 0x1fffe000 0x8000 | 23.225 KiB/s | 45.901 KiB/s load_image ram32k.bin 0x1fffe000 | 23.324 KiB/s | 46.552 KiB/s Cypress' Kitprog in CMSIS-DAP mode, USB FS, adapter_khz 1000 (over firmware limit) dump_image ram64k.bin 0x20000000 0x10000 | 15.537 KiB/s | 42.558 KiB/s load_image ram64k.bin 0x20000000 | 15.605 KiB/s | 43.291 KiB/s Atmel's EDBG, USB HS, adapter_khz 10000 (#3945 applied) dump_image ram384k.bin 0x20400000 0x6000 | 248.402 KiB/s | 345.250 KiB/s load_image ram384k.bin 0x20400000 | 256.039 KiB/s | 365.945 KiB/s Change-Id: I9edbe018086176d357c6aaba5d6b657a5e5e1c64 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4080 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>