aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-01-22flash/nor/sh_qspi: Add SH QSPI driverMarek Vasut
Add driver for the SH QSPI controller. This SPI controller is often connected to the boot SPI NOR flash on R-Car Gen2 platforms. Add the following two lines to board TCL file to bind the driver on R-Car Gen2 SoC and make SRAM work area available: flash bank flash0 sh_qspi 0xe6b10000 0 0 0 ${_TARGETNAME}0 cs0 ${_TARGETNAME}0 configure -work-area-phys 0xe6300000 -work-area-virt 0xe6300000 -work-area-size 0x10000 -work-area-backup 0 To install mainline U-Boot on the board, use the following procedure: proc update_uboot {} { # SPL flash erase_sector 0 0x0 0x0 flash write_bank 0 /u-boot/spl/u-boot-spl.bin 0x0 # U-Boot flash erase_sector 0 0x5 0x6 flash write_bank 0 /u-boot/u-boot.img 0x140000 } Change-Id: Ief22f61e93bcabae37f6e371156dece6c4be3459 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> --- V2: - Add Makefile and linker script for the SH QSPI IO algorithm - Include the algorithm code instead of hard-coding it Reviewed-on: http://openocd.zylin.com/5143 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-22jtag_libusb_bulk_read|write: return error code instead of sizeOleksij Rempel
A USB bulk write/read operation may fail with different errors: LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates transferred) LIBUSB_ERROR_PIPE if the endpoint halted LIBUSB_ERROR_OVERFLOW if the device offered more data, see Packets and overflows LIBUSB_ERROR_NO_DEVICE if the device has been disconnected another LIBUSB_ERROR code on other failures Current OpenOCD code is using the transfer size based error detection. Which may not always work. For example for LIBUSB_ERROR_OVERFLOW as libusb documentation says: "Problems may occur if the device attempts to send more data than can fit in the buffer. libusb reports LIBUSB_TRANSFER_OVERFLOW for this condition but other behaviour is largely undefined: actual_length may or may not be accurate, the chunk of data that can fit in the buffer (before overflow) may or may not have been transferred." This patch is refactoring code to use actual error return value for error detection instead of size. Change-Id: Iec0798438ca7b5c76e2e2912af21d9aa76ee0217 Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-on: http://openocd.zylin.com/4590 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-20mips_ejtag: there is no DCR.MIPS64 bitJiri Kastner
available revisions (2.60, 3.10, 5.06 and 6.10) of MD00047 (EJTAG specification), have only in IMPCODE MIPS32/MIPS64 bit/flag. Change-Id: If9191b6ced760c59bb7551bb041cd72b0a060bb1 Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/4628 Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Tested-by: jenkins
2020-01-17jtag: drivers: xlnx-pcie-xvc: Add support for Xilinx XVC/PCIeMoritz Fischer
Add support for Xilinx Virtual Cable over PCIe JTAG controller. It is commonly used in Xilinx based PCI Express designs with JTAG IP in the FPGA fabric. Access to the JTAG registers happens via the PCI Express extended configuration space. This can be used to debug soft-cores instantiated in the FPGA fabric. The clang static checker doesn't find any new problems with this change. Change-Id: Ib12ede0d1f26dacfda808d5e05b947b640c5bde7 Signed-off-by: Moritz Fischer <moritzf@google.com> Reviewed-on: http://openocd.zylin.com/5314 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Marex Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16flash/nor: Rename flash_address() to cfi_flash_address()Marek Vasut
This is a preparatory change, align the function name with the rest of the API, no functional change. Change-Id: I6a810d2a54edcd13ad9a87d24a7334802c41623b Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5391 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor: Rename get_cfi_info() to cfi_get_info()Marek Vasut
This is a preparatory change, align the function name with the rest of the API, no functional change. Change-Id: Ib967520f027b03eb1792b36ede52335df8e23941 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5390 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor: Allow CFI memory read/write functions be overridenMarek Vasut
Add possibility to supply custom CFI memory accessors via cfi_info and override the default memory-mapped ones. Change-Id: I1b6bc1db69fc33e8cdef96c41742c40e6d8917e9 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5147 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor: Drop size argument of cfi_target_{read,write}_memory()Marek Vasut
The size argument is always set to bank->bus_width and bank pointer is now passed into cfi_target_{read,write}_memory(), so the size can be accessed through the bank pointer inside the function instead of being explicitly passed in. Change-Id: I0abc1cc3bf513281c10cb5de7a21cb0e75cb7676 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5389 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor: Pass flash_bank to memory accessorsMarek Vasut
Replace passing in struct target with passing in struct flash_bank, so that the later can contain function pointers to custom per-driver memory accessor functions. Change-Id: Id2573a6d5f1a73ed9c4f73c53592a9a335a11c99 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5146 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16target/xscale: remove duplicated commandTomas Vanek
Reported by clang static analyzer. Change-Id: I893af10852af4885507ed62d024008159a80dd56 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5382 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16target/etm: add check for calloc errorTomas Vanek
and fix one more clang static analyzer warning. Change-Id: I17f03e318e1cf7617e7f753e7ca960552be547e5 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5381 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16target/semihosting_common: fix minor memory leakTomas Vanek
Reported by clang static analyzer. Change-Id: Ie663f49d92588c0d8b502cfdd8fc34004b308066 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5380 Reviewed-by: Liviu Ionescu <ilg@livius.net> Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16target/target: fix clang static analyzer warningsTomas Vanek
Change-Id: I23e6586be60915f21a7179a994a1ec93fb9b2c36 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5379 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16target/avr32_jtag: fix error returnsTomas Vanek
Fixed only 2 error returns discovered by clang static analyzer. There are obviously many more missing error tests in avr32_jtag.c These was not fixed to keep this change minimal. Not tested with hw. Change-Id: I6c79f6248db774990ddb42c0dacdb621651ed69e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5378 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16target/arm_dpm: add missing error returnsTomas Vanek
Discoverd by clang static analyzer. Change-Id: I93d5de0a36216e62b170fe8cc870431226a7777f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5377 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16target/arm946e: add missing error detectionTomas Vanek
Discoverd by clang static analyzer. While on it remove useless type casts from arm946e_read_cp15() parameter. Change-Id: I549e19685b431400243800ee0f7d1bbe6cdb14b4 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5376 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16server/server: fix clang static analyzer warningTomas Vanek
Change-Id: I317e189b62540e3688a20d88a95f551280317f14 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5373 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16xsvf: fix memory leakTomas Vanek
Discovered by clang static analyzer. Change-Id: I2980586aea5ee43226adb1f4cf72e7ba1dfddd83 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5372 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-01-16flash/nor/stm32l4x: add support of STM32L4P5/L4Q5x devicesTarek BOCHKATI
STM32L4P/Q devices have: - similar flash layout as STM32L4R/S devices - 1024K of flash memory (some parts have 512K only) tested on NUCLEO-L4P5ZG using board/st_nucleo_l4.cfg Change-Id: I77047351bc7dcd7c76d0f31a77be73005104a06f Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5392 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor: add support of STM32WB on top STM32L4 flash driverTarek BOCHKATI
Change-Id: I9fb6700085d817d35a691f6484193f67939a4e0f Signed-off-by: Laurent LEMELE <laurent.lemele@st.com> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/4933 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor: add support of STM32L41/L42xxTarek BOCHKATI
tested using STM32L412KB Change-Id: I1e2ae93d8c740db219f0fb579940de7f2fffac15 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/4934 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-16flash/nor/stm32l4x : add structure containers to hold devices' informationTarek BOCHKATI
This rework is inspired from the 'flash/nor/stm32h7x.c' This rework will ease the support of new devices on top of this driver: for example: STM32WB have different flash base and size addresses Notes: - stm32l4_probe modified in order to charge the correct part_info from the defined stm32l4_parts according to the device id - stm32l4_flash_bank.bank2_start is replaced by .part_info->bank1_sectors - STM32_FLASH_BASE is removed , part_info->flash_regs_base will be used instead based on that flash register addresses are changed to offsets, >> stm32l4_get_flash_reg was modified accordingly - stm32l4_read_option and stm32l4_write_option was modified to accept an offset instead of an absolute address, luckily this is the commands' argument by default - stm32l4_mass_erase modifications : - use MER2 only on top of dual bank devices - wait for BUSY bit before starting the mass erase Change-Id: Ib35bfc3cbadc76bbeaaaba9005b82077b9e1e744 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/4932 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
2020-01-14target/target: parse value as proper typeChristopher Head
The `value` variable is passed into `target_fill_mem` as its second-to-last parameter. That parameter is of type `uint64_t`. It is appropriate to parse the value as that type, since otherwise a target with a 32-bit address space but 64-bit data write capabilities would not be able to exercise those capabilities. Change-Id: Ib336d47d42c27cd2b5ba1206b04e8f740f167dba Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5219 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2020-01-14stlink: fix handling of DPv1 and DPv2 banked registersAntonio Borneo
Arm DPv1 and DPv2 support banked registers by setting the bank in field DPBANKSEL of register DP_SELECT. Old ST-Link firmware don't support banked registers and setting a bank other than bank zero on DPv1 or DPv2 cause issues in the firmware because it cannot set back bank zero to read CTRL/STAT. New ST-Link firmware mask away DPBANKSEL bits while writing in DP_SELECT but support banked register using the same packed method used by OpenOCD: #define BANK_REG(bank, reg) (((bank) << 4) | (reg)) Add a new macro STLINK_F_HAS_DPBANKSEL for firmware that support arm DPv1 and DPv2, plus trigger an error if banked registers are requested on old firmware. Prevent changing DPBANKSEL on old firmware. Log a debug message when changing DPBANKSEL will be ignored. Change-Id: Iaa592517831d63f8da2290db54f6b32504e3081b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4978 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14stlink: add DAP direct driverAntonio Borneo
STLINK-V3 and the new firmware V2J24 for ST-LINK/V2 provide API to directly access the DAP registers. This mode permits to use the native target in cortex_m.c, with no need to override it with the target in hla_target.c. Other advantages wrt HLA are: support for Cortex-A cores, support for SoC multi-core and/or multi AP, support for OpenOCD commands "dap" thus including control of CSW. This obsoletes the existing HLA driver for ST-Link, that should anyway be kept for those cases where it's not possible to update the ST-Link firmware. This commit introduces the minimal implementation for direct DAP access. The implementation is much slower than the HLA because every memory transfer requires several USB packets. Further commits will close the performance gap. The whole ST-Link driver is compiled under BUILD_HLADAPTER, to remove the need to split the driver between the two modes. This has to be reworked, but it's quite invasive! A new interface file stlink-dap.cfg is added and should be used in place of stlink.cfg to enable the DAP mode. Documentation is updated and reports limitation on the maximum AP number that can be accessed by ST-Link for some firmware already tested. Change-Id: I932ffe16bc81d00b1fe489e2944fda13470cce9b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4904 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14adi_v5_dapdirect: add support for adapter drivers that provide DAP APIAntonio Borneo
Some high level adapters, like STLINK-V3 and new firmware for ST-Link/V2, provide API to directly access the DAP registers hiding the details of the physical transport JTAG or SWD. OpenOCD has already the intermediate API in struct dap_ops that are suitable for such adapters, but are not exposed to the adapter drivers. Add in struct adapter_driver two independent struct dap_ops for the cases of physical JTAG and SWD transport. Add new transport names "dapdirect_jtag" and "dapdirect_swd", to be used by the drivers that provide one or both DAP API. Add the necessarily glue in target/adi_v5_dapdirect.c Change-Id: I2bb8e3a80fba750f2c218d877cfa5888428e3c28 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4903 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14TODO: add restructuring of JTAG/adapter layerAntonio Borneo
SWD is already implemented, so remove the item. Rename the section JTAG as Adapter, including the subsections. Add an initial list of pending activities after the restructure of the JTAG layer. Change-Id: I540777344c62a746df8347538fe8b29e4d72e1c7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4901 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14adapter: switch from struct jtag_interface to adapter_driverAntonio Borneo
To reorganize the adapters code, introduce an adapter_driver struct that contains all the adapter generic part, while keeping in two separate struct the specific API jtag_ops and swd_ops. Move the allocation of *adapter_driver from the JTAG-specific file core.c to the more adapter-specific file adapter.c While splitting the old jtag_interface for every driver, put the fields in the same order as in the struct declaration so we keep a consistent code across all the drivers. While other transport specific API could/would be added as separate ops, nothing is done here for HLA. Change-Id: I2d60f97ac514c0dd2d93a6ec9be66fd9d388dad5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4900 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14drivers/kitprog: remove unused JTAG execute_queue methodAntonio Borneo
kitprog is SWD only and we do not rely on JTAG queue anymore. Remove the remaining JTAG heritage. Change-Id: Ic586278368301eb669bc6e4e641f683a81cb171d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4899 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14hla: remove empty JTAG execute_queue methodAntonio Borneo
We do not rely on JTAG queue anymore. Remove the remaining JTAG heritage. Change-Id: I6c87d9ffebaa383c998cf273188b3e7f28b3fe95 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4898 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14jtag: print an errmsg on using jtag API for non jtag transportAntonio Borneo
After the cleanup of swd and hla, there should be no more calls to jtag_execute_queue() or to queue jtag commands if current transport is not jtag. Thus we can start removing the jtag specific code from adapters that do not support jtag. To prevent some remaining call to jtag_execute_queue() to crash openocd, verify the transport, print an error message if the transport is not jtag, call the adapter's jtag_execute_queue() only if it exist. To identify code that still add commands in the jtag queue even if transport is not jtag, print an error message in the function jtag_queue_command(). For the moment, still queue the message, even if will cause a memory leak if there is no following call to jtag_execute_queue(); the target is to identify the issue and cleanup the code, thus solving also the leak. Change-Id: I8fc85f754aa057aad1df05ff0448c8619897da23 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4897 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14hla: use the new system_reset APIAntonio Borneo
HLA uses its own internal driver's API to control the adapter's system reset, but at the same time it calls jtag_add_reset() to avoid breaking the internal logic of OpenOCD. This implicitly forces HLA to rely on jtag queue mechanism, even if HLA has no link with JTAG state machine. It requires HLA to implement an empty execute_queue() to comply with the JTAG queue. Modify the HLA framework and the HLA targets to use the new adapter API for system_reset and decouple HLA from JTAG queue. Rename the HLA static functions adapter_assert_reset() and adapter_deassert_reset() to avoid overlap with the global functions with same name. While there, fix a minor typo in a comment s/incase/in case/. Do not remove from HLA the JTAG specific API execute_queue(), even if not required anymore, because OpenOCD code still has calls to jtag_execute_queue() in case of non JTAG transport. Change-Id: I0e65e3e557bd665bd3d3aeaa84ea609b55a05e48 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4896 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14bitbang: jtag-only drivers: switch to new reset APIAntonio Borneo
Remove the JTAG_RESET command from the bitbang execute queue now that all bitbang drivers have moved away from old reset method. Remove also the internal reset API in struct bitbang_interface. Tested parport only. Change-Id: I12b157ef442f4c9912406b19b7a4d32ba6ec0b53 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5300 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-14swd: get rid of jtag queue to assert/deassert srstAntonio Borneo
The transport SWD uses the JTAG queue to assert/deassert the system reset srst. This is the major inconsistency that has to be removed to properly split JTAG and SWD. Introduce a new driver API, reset(), to controls both the signals trst and srst in the driver, skipping the JTAG queue. Put the new API in struct jtag_interface, even if in this patch it's used for SWD only; the goal is to get it reused by the other transports. Add the implementation of the API in all the drivers that implement SWD. Such implementation is almost the same of the old code in JTAG queue. Create a wrapper adapter_system_reset() to use the new API and remove the SWD specific swd_add_reset(). In the wrapper replace jtag_add_sleep() with jtag_sleep(), because the former uses the JTAG queue too. Rename the old jtag_add_reset() as legacy_jtag_add_reset() with the target to remove it when all drivers would be ported to the new reset API. Create a new jtag_add_reset() that calls the legacy function for drivers still on the old reset API. Use the new API also on JTAG transport for the drivers that can support both SWD and JTAG. For the moment, do not modify the implementation of JTAG-only drivers, which will continue using the usual method. This should be cleaned-up in future commits. Change-Id: I32331c88313f6059b25e12c6bb0156aebc1c074f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4895 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-05flash/nor: Factor out CFI memory read/write functionsMarek Vasut
Create separate memory read/write functions which facilitate access to the CFI NOR, so that they can be replaced by controller-specific functions if necessary. This would become necessary when implementing support for e.g. HyperFlash controllers, which do not directly map the HyperFlash into the address space. Change-Id: I1bba1edfd397cb37bfedb43efe2dd03feb26a375 Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5145 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2020-01-05flash/nor: Factor out cfi_spansion_unlock_seq()Marek Vasut
Factor out the spansion unlock sequence to deduplicate the code. Change-Id: Id78522e9a2f0e701870ef816772289d08257476a Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-on: http://openocd.zylin.com/5144 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2020-01-03flash/nor/stm32f2x: Support value line chips with trimmed flashKeir Fraser
The current code assumes an STM32's flash bank is laid-out in either of two configurations: - 4 x 16kB + 1 x 64kB + n x 128kB - 4 x 32kB + 1 x 128kB + n x 256kB This is quite ad-hoc but works fine in practice, as long as there are at least 5 sectors (if n=0). Unfortunately, some newer STM32s are shipping with only 64 kB of flash (4 x 16kB sectors). This patch still assumes the same sector layout, but only keeps adding sectors to the bank if the bank's capacity has not been reached. This prevents openocd from crashing on some newer STM32s. Change-Id: If00e5d7a328d11b399babc0bb2111e3ad8a3217e Signed-off-by: Romain Goyet <romain.goyet@numworks.com> Signed-off-by: Keir Fraser <keir.xen@gmail.com> Reviewed-on: http://openocd.zylin.com/4926 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02arm_adi_v5: add API send_sequence() and use itAntonio Borneo
The method to send an arbitrary sequence to DAP depends on the transport and is thus different on JTAG and SWD. This is already coded in dap_to_jtag() and dap_to_swd(). Add a new API send_sequence() in struct dap_ops. Add the implementations of send_sequence() in adi_v5_jtag.c and adi_v5_swd.c Rewrite dap_to_jtag() and dap_to_swd() using the new API. Move the enum swd_special_seq in arm_adi_v5.h to solve a circular dependencies among swd.h and arm_adi_v5.h Change-Id: I9db13a00f129761eab283783c094cfff2dd92610 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4902 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02tcl: update scripts after "jtag_reset" got deprecatedAntonio Borneo
Avoid annoying "deprecated" messages in the scripts distributed with OpenOCD code. Change-Id: I82d27cd420db30f0653efbd286a627ef56a8c1fd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5287 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02jtag: replace command "jtag_reset" with "adapter [de]assert"Antonio Borneo
Replace the JTAG transport specific command with a more generic one. Deprecate "jtag_reset" and update the documentation. While there, fix an error in the documentation, where the command "jtag_reset" was used in place of command "reset_config". Change-Id: I41a988d37ce69f7b35a960cbaf5306aab0299b99 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5286 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02adapter: add command "adapter [de]assert srst|trst [[de]assert srst|trst]"Antonio Borneo
Inspired from http://openocd.zylin.com/#/c/3720/1 Add commands to control the adapter's signals srst and trst. Add macros for the flag's values assert/deassert to make clear what they mean and to propose a uniform set of values across the code. Change-Id: Ia8b13f4ded892942916cad7bda49540a896e7218 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5277 Tested-by: jenkins
2020-01-02jtag_vpi: multiple improvementsJan Matyas
- Fix: Proper handling of read_socket() and write_socket() in case of "partial" read/write. - Added low-level JTAG IO debug capability (_DEBUG_JTAG_IO_) - Zero-fill packet buffers, avoid sending pieces of uninitialized memory over the network (memset struct vpi_cmd) - Use close_socket() instead of close() - needed for Win32 - Fixed usage messages of jtag_vpi_command_handlers Change-Id: I8bd19bc5c9512fe8e798600212e8a95213f50f5b Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: http://openocd.zylin.com/5177 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02flash/nor/stm32f1x: fix options reading from locked chipOleksandr Redchuk
In commit cea40152f82f52bfc718c7bda9fa4a9d70bf9cfd option bytes reading was changed to direct access to option bytes area. While there are no problems with stm32f0xx and stm32f3xx chips, option block (0x1ffff800..0x1ffff80F) is unreadable from locked stm32f10x chips. As a result, stm32f1x unlock command writes dirty values to user options, user data and write protection bits. Option bytes reading reverted from direct access to option bytes area to reading currently loaded bytes from FLASH_OBR/FLASH_WRPR registers. Tested on stm32f100, stm32f103, stm32f107 as well as on stm32f030 and stm32f303. Change-Id: Iad476351ffdaca5ace12e02272dacea7f3d08f52 Signed-off-by: Oleksandr Redchuk <real@real.kiev.ua> Reviewed-on: http://openocd.zylin.com/4940 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02contrib/rpc_examples: Add (dis)connect methodsMarc Schink
Add these methods such that the OpenOcd class can also be used outside of a 'with' statement. Change-Id: I927c93fff2dc05cc74daa56360a7262e736a639f Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/5189 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02rtos/FreeRTOS: Fix FreeRTOS thread list readingRahul Masurkar
Change-Id: I749ae94ec7279907b1905c02ecc1e9661f43ef70 Signed-off-by: Rahul Masurkar <rahulgm@marvell.com> Reviewed-on: http://openocd.zylin.com/5273 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02flash/nor/kinetis: fix clang static analyzer warningsTomas Vanek
Use assert to remove "Dereference of null pointer" warnings. Change-Id: Ie204c234a71758e6470351e1d9f22da3dd887f56 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5357 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-01-02target/arm_cti: add new 'ack' and 'channel' commandsTarek BOCHKATI
these commands have been introduced to ease the manipulation of CTI trough script files, these commands are: - $cti_name ack $event : to acknowledge a CTI event - $cti_name channel $channel_number $operation: to perform an operation on a specific channel, the possible operations are: gate, ungate, set, clear and pulse Change-Id: I35463867a3c85072f3776c3aeb1e5788953ec435 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5315 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2020-01-02flash/nor/stm32h7: (minor) use proper variable names and enhance loggingTarek BOCHKATI
-fsize_base should be fsize_addr as it is the address of FLASH_SIZE register -flash_base should be flash_regs_base to avoid confusion with flash block start -add LOG_ERROR to functions stm32x_[read|write]_flash_reg(...) Change-Id: I86f035314bcd616fc0bdf445692d945a85c15481 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5362 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-01-02tcl/target: swm050: fix to allow to use with ST-LinkIcenowy Zheng
Currently the code assumes the adapter uses raw SWD, and the expected ID code of the CPU is even wrong. An adapter speed is also not specified. All these prevents the config file to be used with ST-Link. Fix the config file, to allow it to be used with ST-Link. Change-Id: I1244320fabfe8ee23da5a56a592dbeddc72cc8d5 Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Reviewed-on: http://openocd.zylin.com/5297 Tested-by: jenkins Reviewed-by: Caleb Szalacinski <contact@skiboy.net> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-12-21target/armv7m_trace: Improve SWO frequency auto-detectionMarc Schink
The SWO frequency auto-detection with J-Link adapters does not work properly in the current implementation. This is because the trace layer has only information about the highest possible SWO frequency supported by the adapter. With that the trace layer calculates the SWO prescaler which usually leads to a frequency deviation greater than what is permitted by J-Link adapters. Move the calculation of the SWO prescaler from the trace layer into the trace configuration of the adapter to overcome this problem. The adapter has the necessary information to choose a suitable SWO frequency and calculate the corresponding prescaler that complies with the maximum allowed frequency deviation. Tested with: - STM32L152RC Discovery Kit (ST-Link) - EFM32GG-STK3700 (J-Link) Change-Id: I38ff2b89d32f0a92c597989b590afe5c75cf4902 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3903 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>