openocd.git
4 years agojtag/libusb_helper: permit adapters to compute their custom serials 96/5496/4
Tarek BOCHKATI [Fri, 6 Mar 2020 12:52:23 +0000 (13:52 +0100)]
jtag/libusb_helper: permit adapters to compute their custom serials

introduce a callback function that could be passed to jtag_libusb_open
to permit adapters to compute their custom/exotic serials.

the callback should return a non NULL value only when the serial could not
be retrieved by the standard 'libusb_get_string_descriptor_ascii'

Change-Id: Ib95d6bdfc4ee655eda538fba8becfa183c3b0059
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5496
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/stm32h7x: use proper data type (bool) for has_dual_bank 00/5500/3
Tarek BOCHKATI [Tue, 17 Mar 2020 15:31:51 +0000 (16:31 +0100)]
flash/stm32h7x: use proper data type (bool) for has_dual_bank

+ minor changes in comments' alignment to please our eyes

Change-Id: Ifa35a1032afc4e9aee524f596c0298a9eea49c37
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5500
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
4 years agoflash/nor: check fill pattern fits in word size 92/5492/3
Christopher Head [Tue, 3 Mar 2020 21:25:50 +0000 (13:25 -0800)]
flash/nor: check fill pattern fits in word size

Change-Id: Idad527a428ceed2b53f3da41fb0c64bf8e62614a
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5492
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
4 years agortos: Destroy RTOS and fix memory leak 79/5479/3
Marc Schink [Thu, 27 Feb 2020 12:48:15 +0000 (13:48 +0100)]
rtos: Destroy RTOS and fix memory leak

The memory leak can be reproduced by using an arbitrary RTOS
and valgrind:

 $ valgrind --leak-check=full --show-leak-kinds=all

[...]
==9656== 224 (80 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
==9656==    at 0x483CD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==9656==    by 0x1C541A: os_alloc (rtos.c:79)
==9656==    by 0x1C569E: os_alloc_create (rtos.c:111)
==9656==    by 0x1C569E: rtos_create (rtos.c:153)
==9656==    by 0x1AE332: target_configure (target.c:4899)
==9656==    by 0x1AF228: jim_target_configure (target.c:4952)
==9656==    by 0x1C9EF9: command_unknown (command.c:1066)
==9656==    by 0x313284: JimInvokeCommand (jim.c:10364)
==9656==    by 0x313FB6: Jim_EvalObj (jim.c:10814)
==9656==    by 0x3154A3: Jim_EvalFile (jim.c:11207)
==9656==    by 0x316015: Jim_SourceCoreCommand (jim.c:15230)
==9656==    by 0x313284: JimInvokeCommand (jim.c:10364)
==9656==    by 0x313B8B: JimEvalObjList (jim.c:10605)
[...]

Change-Id: I2cd41a154fb8570842601ff4e3e76502f5908f49
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5479
Tested-by: jenkins
Reviewed-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoflash/startup.tcl: add STM32G0 and G4 aliases 82/5482/4
Tarek BOCHKATI [Sun, 1 Mar 2020 21:38:50 +0000 (22:38 +0100)]
flash/startup.tcl: add STM32G0 and G4 aliases

STM32G0 and G4 uses the same flash driver as the stm32l4x

Change-Id: Ic1c4be70aaee809536912e0390f07893efb9a082
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5482
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoFlash driver for STM32G0xx and STM32G4xx 07/4807/11
Andreas Bolsch [Sun, 16 Dec 2018 16:30:41 +0000 (17:30 +0100)]
Flash driver for STM32G0xx and STM32G4xx

Flash module of STM32G0/G4 family is quite similar to the one of
STM32L4, so only minor changes are required, in particular
adaption of flash loader to Cortex-M0. Register addresses
passed to flash loader to simplify integration of L5.
Added re-probe after option byte load.
Added flash size override via cfg file.
WRPxxR mask now based on max. number of pages instead of fixed 0xFF,
as G4 devices fill up unused bits with '1'.
Sizes in stm32l4_probe changed to multiples of 1kB.

Tested with Nucleo-G071RB, G030J6, Nucleo-G431RB and Nucleo-G474RE.
Gap handling in G4 Cat. 3 dual bank mode tested with STM32G473RB.
This handling isn't optimal as the bank size includes the
size of the gap. WB not tested.

Change-Id: I24df7c065afeb71c11c7e96de4aa9fdb91845593
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: http://openocd.zylin.com/4807
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotcl/target: Fix naming of RZ/A1 SoC 45/5445/5
Marek Vasut [Sat, 8 Feb 2020 06:02:28 +0000 (07:02 +0100)]
tcl/target: Fix naming of RZ/A1 SoC

The RZ/A1 is not part of the R-Car family, but is rather an RZ family.
Fix the naming.

Change-Id: I5f882b2467e87e534e0f1c827554e664a7d55664
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5445
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agodrivers: xds110: Fix errors in routine that toggles 97/5497/2
Edward Fewell [Fri, 6 Mar 2020 20:39:14 +0000 (14:39 -0600)]
drivers: xds110: Fix errors in routine that toggles
TCK during nSRST assert/deassert code.

To support LPRF targets (CC13xx/CC26xx), TCK must be toggled
for 50 ms while nSRST is asserted and right after it is
released. This allows the core to halt in boot ROM before
code is run that might interfere with debug access.

The current routine has two issues. It shouldn't be run at
all if the target is using SWD. And the delay needs to
be a real-time 50 ms, so the number of TCK periods should
be calculated off the set speed.

Change-Id: If993031b84cf2a505ea67a6633602c4b01cd8e1e
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/5497
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotarget/cortex_a: add hypervisor mode 61/5261/2
Antonio Borneo [Tue, 25 Jun 2019 14:01:38 +0000 (16:01 +0200)]
target/cortex_a: add hypervisor mode

Hypervisor mode is present only if the optional virtualization
extensions are available. Moreover, virtualization extensions
require that also security extensions are implemented.

Add the required infrastructure for the shadowed registers in
hypervisor mode.
Make monitor shadowed registers visible in hypervisor mode too.
Make hypervisor shadowed registers visible in hypervisor mode
only.
Check during cortex_a examine if virtualization extensions are
present and then conditionally enable the visibility of both
hypervisor and monitor modes shadowed registers.

Change-Id: I81dbb1ee8baf4c9f1a2226b77c10c8a2a7b34871
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5261
Tested-by: jenkins
4 years agoarmv7a: access monitor registers only with security extensions 59/5259/2
Antonio Borneo [Mon, 24 Jun 2019 16:28:31 +0000 (18:28 +0200)]
armv7a: access monitor registers only with security extensions

Accordingly to ARM DDI 0406C at B1.5, the security extensions for
armv7a are optional extensions and can be detected by reading
ID_PFR1.
The monitor mode is part of the security extensions and the shadow
registers "sp_mon", "lr_mon" and "spsr_mon" are only present with
the security extensions.

Read the register ID_PFR1 during cortex_a examine, determine if
security extension is present and then conditionally enable the
visibility of the monitor mode shadow registers.

Change-Id: Ib4834698659046566f6dc5cd35b44de122dc02e5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5259
Tested-by: jenkins
4 years agotarget/armv4_5: remove unused macro 60/5260/2
Antonio Borneo [Mon, 24 Jun 2019 16:45:11 +0000 (18:45 +0200)]
target/armv4_5: remove unused macro

The macro ARMV4_5_CORE_REG_MODENUM() is unused.
Remove it!

Change-Id: I183df57bd86c9428710ea3583e43fba88fd26e0a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5260
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
4 years agoarm: Use different enum for core_type and core_mode 58/5258/2
Antonio Borneo [Mon, 24 Jun 2019 15:15:33 +0000 (17:15 +0200)]
arm: Use different enum for core_type and core_mode

The fields core_type and core_mode use the same enum arm_mode
but encode different information, making the code less immediate
to read.

Use a different enum arm_core_type for the field core_type.
The code behavior is not changed.

Change-Id: I60f2095ea6801dfe22f6da81ec295ca71ef90466
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5258
Tested-by: jenkins
4 years agoarm: fix reg num for Monitor mode 57/5257/2
Antonio Borneo [Mon, 24 Jun 2019 10:17:17 +0000 (12:17 +0200)]
arm: fix reg num for Monitor mode

Commit 2efb1f14f611 ("Add GDB remote target description support
for ARM4") inserts two additional registers "sp" and "lr" in the
table arm_core_regs[], thus shifting by two the position of the
last three registers already present
"sp_mon" moved from index 37 to 39
"lr_mon" moved from index 38 to 40
"spsr_mon" moved from index 39 to 41
Part of the code is updated (e.g. enum defining ARM_SPSR_MON and
array arm_mon_indices[]), but it's missing the update of mapping
in armv4_5_core_reg_map[].

Fix armv4_5_core_reg_map[].

Change-Id: I0bdf766183392eb738206b876cd9559aacc29fa0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 2efb1f14f611 ("Add GDB remote target description support for ARM4")
Reviewed-on: http://openocd.zylin.com/5257
Tested-by: jenkins
4 years agoftdi: flush mpsse queue after a level change on reset pins 31/5431/2
Antonio Borneo [Mon, 3 Feb 2020 15:48:40 +0000 (16:48 +0100)]
ftdi: flush mpsse queue after a level change on reset pins

The function ftdi_set_signal() does not propagate the pin change
until next call to mpsse_flush(). Current code does not toggles
immediately the reset pins if polling is turned off.

Call mpsse_flush() at the end of ftdi_reset().
While there, remove the duplicated LOG message.

Change-Id: I79eacfe4fc32b5cdf2dc1b78f3660d96988466bc
Fixes: 8850eb8f2c51 ("swd: get rid of jtag queue to assert/deassert srst")
Reported-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5431
Tested-by: jenkins
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agojimtcl: update to tag 0.79 03/5403/3
Antonio Borneo [Sat, 19 Oct 2019 17:46:53 +0000 (19:46 +0200)]
jimtcl: update to tag 0.79

OpenOCD is stuck at jimtcl tag 0.77 that is 3 years old.
The latest tag 0.79 (2019-11-20) is already used by debian build,
which packs jim library separately, as shown in [1]. Today only
the build for architecture powerpcspe is still not updated to
latest package version.
I have been using jim 0.79 since the day of the release, without
any issue.

Switch jimtcl to latest tag 0.79

[1] https://packages.debian.org/sid/openocd

Change-Id: I3426e68c32f88ecde74d4278303925423db451e0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5403
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotarget: fix crash with jimtcl 0.78 53/5453/2
Antonio Borneo [Fri, 14 Feb 2020 13:35:51 +0000 (14:35 +0100)]
target: fix crash with jimtcl 0.78

The jimtcl commit 41c5ff1809f5 ("jim.c: Fix Object leak in zlib
support") https://repo.or.cz/jimtcl.git/commit/41c5ff1809f5
makes Jim_SetResultFormatted() freeing the parameters that have
zero refcount.

OpenOCD commit 559d08c19ed8 ("jim tests: use installed") adds the
only code instance in OpenOCD that first passes a zero refcount
object to Jim_SetResultFormatted() and then frees it.
By switching jimtcl version to 0.78 or newer this causes a crash
of OpenOCD.
To trigger the crash in a telnet session, check that the current
target is running and type:
[target current] arp_waitstate halted 1

Remove the call to Jim_FreeNewObj() after the call to
Jim_SetResultFormatted().

Change-Id: I5f5a8bca96a0e8466ff7b789fe578ea9785fa550
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5453
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agojtag: report API reset as synchronous 71/5471/2
Antonio Borneo [Mon, 24 Feb 2020 11:26:07 +0000 (12:26 +0100)]
jtag: report API reset as synchronous

The jtag API reset() is synchronous, but this was not highlighted
in the description.

Change-Id: I76ffb7eec97c8608cfbef0b9268ee18a5f50b221
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 8850eb8f2c51 ("swd: get rid of jtag queue to assert/deassert srst")
Reviewed-on: http://openocd.zylin.com/5471
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
4 years agosemihosting: add semihosting handlers to AArch64 74/5474/2
Tarek BOCHKATI [Tue, 25 Feb 2020 18:44:58 +0000 (19:44 +0100)]
semihosting: add semihosting handlers to AArch64

note: this works only when the PE is in AArch64 state

Change-Id: Id6a336ca7d201df72bd1aaaeccce4185473fc1bd
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5474
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agocortex_a: warn on broken debug_base setting 05/5105/3
Matthias Welwarsky [Thu, 11 Apr 2019 08:22:27 +0000 (10:22 +0200)]
cortex_a: warn on broken debug_base setting

A common problem with target configurations appears to be broken
debug base address configuration. ARM DDI0406C.d specifies in App. D,
1.4.1, that bit 31 of the debug base address serves as identification
of an external debugger, as opposed to an internal access to memory
mapped debug registers by the CPU. External accesses are treated
as privileged and require no debug authentification via the lock
access register.

Sometimes the base address of a debug component is wrong even
in the targets' ROM table. In this case, the correct base address
must be specified using the -dbgbase argument when creating the
target.

This patch adds a warning when bit 31 of the debug base address
is not set, as a hint to the user.

Change-Id: I9c41d85a138123c657ef655e3436a2aa39249dcc
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/5105
Tested-by: jenkins
Reviewed-by: Tommy Vestermark <tov@vestermark.dk>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agotarget/armv8_opcodes: use T32 instructions when the PE is in AArch32 state 46/5346/3
Tarek BOCHKATI [Mon, 9 Dec 2019 11:47:07 +0000 (12:47 +0100)]
target/armv8_opcodes: use T32 instructions when the PE is in AArch32 state

As stated in ARM v8-A Architecture Reference Manual (ARM DDI 0487E.a)
in Chapter H4.3 DCC and ITR access modes:
    Writes to EDITR trigger the instruction to be executed if the PE
    is in Debug state:
      - If the PE is in AArch64 state, this is an A64 instruction.
      - If the PE is in AArch32 state, this is a T32 instruction

But in armv8_opcodes specifically in t32_opcodes we were using some
A32 instructions for HLT, LDRx and STRx opcodes.

Using the correct LDRx and STRx opcodes, fixes 16 and 8 bits memory access
when the PE is in AArch32 state.

Change-Id: Ib1acbdd4966297e7b069569bcb8deea3c3993615
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5346
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agotarget/aarch64: fix soft breakpoint when PE is in AArch32 state 55/5355/2
Tarek BOCHKATI [Wed, 4 Dec 2019 14:09:51 +0000 (15:09 +0100)]
target/aarch64: fix soft breakpoint when PE is in AArch32 state

Before this patch aarch64_set_breakpoint was using either A64, or A32
HLT opcode by relying on armv8_opcode helper.
This behaviors ignores the fact that in AArch32 state the core could
execute Thumb-2 instructions, and gdb could request to insert a soft
bkpt in a Thumb-2 code chunk.

In this change, we check the core_state and bkpt length to know the
correct opcode to use.

Note: based on https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Breakpoint-Kinds.html
      if bkpt length/kind == 3, we should replace a 32-bit Thumb-2 opcode,
      then we use twice the 16 bits Thumb-2 bkpt opcode and we fix-up the
      length to 4 bytes, in order to set correctly the bpkt.

Change-Id: I8f3551124412c61d155eae87761767e9937f917d
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5355
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agotarget/aarch64: fix minor stepping issue with gdb 54/5354/2
Tarek BOCHKATI [Mon, 9 Dec 2019 11:35:01 +0000 (12:35 +0100)]
target/aarch64: fix minor stepping issue with gdb

when using step command from gdb the step happens without any issue,
but aarch64_step call explicitly aarch64_poll which consumes the
status change to HALTED, so it does not inform gdb that the step has
finished.

by removing this call, all is back to normal and openocd could inform gdb
that the step has finished.

Change-Id: I9366aecd20f7d52259b050b8653189b67d9299d0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5354
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agotarget: add examine-fail event 89/4289/9
Tomas Vanek [Sat, 4 Nov 2017 08:47:02 +0000 (09:47 +0100)]
target: add examine-fail event

A configuration script may want to check the reason why examine fails
e.g. device has security lock engaged.

tcl/target/kx.cfg and klx.cfg is modified to use the new event
for testing of the security lock of Kinetis MCU

Change-Id: Id1d3a79d24e84b513f4ea35586cd2ab0437ff9b3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4289
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agoAdd target config for STM8S103 chip... 22/5422/2
Anton V. Kirilchik [Tue, 12 Mar 2019 20:11:39 +0000 (23:11 +0300)]
Add target config for STM8S103 chip...

Change-Id: I693e5b7933fc61956010a96be57ee6eb8abd3c31
Signed-off-by: Anton V. Kirilchik <kosmonaffft@gmail.com>
Reviewed-on: http://openocd.zylin.com/5422
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agosemihosting: reorganize semihosting commands 73/5473/3
Tarek BOCHKATI [Tue, 25 Feb 2020 18:35:44 +0000 (19:35 +0100)]
semihosting: reorganize semihosting commands

the same semihosting handlers chain is declared twice:
 1. in src/target/armv4_5.c
 2. in src/target/riscv/riscv.c

to make it simpler we moved the declaration into
'src/target/semihosting_common.c' under semihosting_common_handlers[].
then we used this into both of armv4_5.c and riscv.c

Change-Id: If813b3fd5eb2476658f1308f741c4e805141f617
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5473
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Liviu Ionescu <ilg@livius.net>
4 years agoflash/stm32h7x: fix bank sizes for devices with trimmed flash 42/5442/4
Tarek BOCHKATI [Fri, 7 Feb 2020 11:52:14 +0000 (12:52 +0100)]
flash/stm32h7x: fix bank sizes for devices with trimmed flash

STM32H7yxxI: dual independent 1 MByte banks
STM32H7yxxG: dual independent 512 Kbyte banks
STM32H7yxxB: single 128 Kbyte bank

where y = [4/5] or [A/B]

references: (documents are available in www.st.com)
 - STM32H7[4/5]x[G/I] : DS12110 Rev 7
    >> 3.3.1 Embedded Flash memory
 - STM32H750xB : RM0433 Rev 6
    >> Table 11. Flash memory organization on STM32H750xB devices
 - STM32H7[A/B]x[B/G/I] : RM0455 Rev 3
    >> 4.3.4 Flash memory architecture and usage

Change-Id: Ic9346964ef2554abf47f5832e25adfdc77bd323e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5442
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
4 years agotcl/target: Unify Renesas R-Car JTAG reset config 00/5400/8
Marek Vasut [Wed, 15 Jan 2020 04:42:03 +0000 (05:42 +0100)]
tcl/target: Unify Renesas R-Car JTAG reset config

Both Gen2 and Gen3 used the same init_reset{} implementation,
pull it into common file and include it from both generations.
Moreover, this behavior is SoC specific, not board specific,
so move the common init_reset into target/ directory.

Change-Id: I5489a4bff9a786da8cb7fd7a515b0c9ce9dc16e3
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5400
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor: update support for TI MSP432 devices 81/5481/2
Edward Fewell [Fri, 28 Feb 2020 22:56:11 +0000 (16:56 -0600)]
flash/nor: update support for TI MSP432 devices

Added fixes for issues found in additional code reviews.

Fixed host Endianness issues with using buffer reads
and writes instead of the *_u32 variants.

Changed code that tried to ID banks by hardcode
bank_number values to use instead the bank base
address. This fixes problems using configurations
with multiple devices.

Note that this replaces Change 4786 which has
been abandoned because of extensive changes to
the code to stop IDing banks by name.  And I
think I really messed up a rebase/merge on the
document file.

Tested on MSP432P401R, MSP432P4111, and MSP432E401Y
Launchpads.

Change-Id: Id05798b3aa78ae5cbe725ee762a164d673ee5767
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/5481
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agobluenrg-x: simplyfied the driver 93/5393/4
luca vinci [Wed, 8 Jan 2020 09:15:40 +0000 (10:15 +0100)]
bluenrg-x: simplyfied the driver

Adopted only fast algorithm for flash programming:
- write_word and write_byte methods have been removed.
- start and end write alignments have been defined.
Moved flash controller registers offsets in a common file
shared with the flash algorithm.
- the flash base address is passed to the flash algorithm
  as a parameter.
Removed unused functions

Change-Id: I80aeab3994e477044bbcf02e66d9525dae0cb491
Signed-off-by: luca vinci <luca.vinci@st.com>
Reviewed-on: http://openocd.zylin.com/5393
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Michele Sardo <msmttchr@gmail.com>
4 years agobluenrg-x: added support for BlueNRG-LP device 43/5343/3
luca vinci [Tue, 5 Nov 2019 07:45:04 +0000 (08:45 +0100)]
bluenrg-x: added support for BlueNRG-LP device

Extended bluenrg-x flash driver with BlueNRG-LP flash controller.
Changes include:
- register set for the flash controller
- made software structure prone to support more easily future devices
- updated target config file

Change-Id: I2e2dc70db32cf98c62e3a43f2e44a4600a25ac5b
Signed-off-by: luca vinci <luca.vinci@st.com>
Reviewed-on: http://openocd.zylin.com/5343
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agohelper/binarybuffer: fix clang static analyzer warnings 83/5383/3
Tomas Vanek [Fri, 20 Dec 2019 22:56:08 +0000 (23:56 +0100)]
helper/binarybuffer: fix clang static analyzer warnings

Writing bits to an uninitialized buffer generated false warnings.
Zero buffers before setting them by buf_set_u32|64()
(do it only if bit-by-bit copy loop is used,
zeroed buffer is not necessary if a fast path write is used)

Change-Id: I2f7f8ddb45b0cbd08d3e249534fc51f4b5cc6694
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5383
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
4 years agotarget/arm920t: fix clang static analyzer warning 75/5375/2
Tomas Vanek [Fri, 20 Dec 2019 22:43:13 +0000 (23:43 +0100)]
target/arm920t: fix clang static analyzer warning

Change-Id: I570dfb8b20a3f187f1fe660343cf0b75691e2c30
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5375
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agortos/linux: fix use of memory after it is freed 71/5371/2
Tomas Vanek [Fri, 20 Dec 2019 22:35:12 +0000 (23:35 +0100)]
rtos/linux: fix use of memory after it is freed

Discovered by clang static analyzer

Change-Id: I9f64a67f281b95562d8fd6e2ebb0ae3f79ae8039
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5371
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agojtag/drivers/openjtag: fix clang static analyzer warnings 69/5369/2
Tomas Vanek [Fri, 20 Dec 2019 22:33:55 +0000 (23:33 +0100)]
jtag/drivers/openjtag: fix clang static analyzer warnings

Change-Id: I900ce8157b3e220a4647871080bb9abc772446d1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5369
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agojtag/aice: fix clang static analyzer warnings 68/5368/2
Tomas Vanek [Fri, 20 Dec 2019 22:32:37 +0000 (23:32 +0100)]
jtag/aice: fix clang static analyzer warnings

Change-Id: I6c801c2406cd117f2bcf930a5b329c441ab5f1ff
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5368
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor/numicro: use flash infrastructure to align write 67/5367/2
Tomas Vanek [Fri, 20 Dec 2019 22:26:51 +0000 (23:26 +0100)]
flash/nor/numicro: use flash infrastructure to align write

The aligning code generated a clang static analyzer warning and
imposed huge memory leak. This part of code was removed and
flash infrastructure to alignment is used instead.

Not tested on hw!

Change-Id: I7c71da87547e71d595a7e7071ae5adcc1cecc827
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5367
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor/fm4,tms470: fix clang static analyzer warnings 66/5366/2
Tomas Vanek [Fri, 20 Dec 2019 22:23:26 +0000 (23:23 +0100)]
flash/nor/fm4,tms470: fix clang static analyzer warnings

Change-Id: I18c1501918d40453fea6aeeb6f035e46d41fc524
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5366
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agosrc/flash/nor/at91sam3|4l|7: fix clang static analyzer warnings 65/5365/2
Tomas Vanek [Fri, 20 Dec 2019 22:18:37 +0000 (23:18 +0100)]
src/flash/nor/at91sam3|4l|7: fix clang static analyzer warnings

Change-Id: I5cd2b2ebb2bd1980bdd1632b5c35bda9718a1089
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5365
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor/stm32f1x: Group and cleanup device list 23/5423/4
Marc Schink [Tue, 28 Jan 2020 09:53:35 +0000 (10:53 +0100)]
flash/nor/stm32f1x: Group and cleanup device list

Group device list based on the device family and add clear
device family names.

Change-Id: I7a2dab1d1c0c8d141df02656c1964cb2c3fcbcd1
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5423
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agodrivers: Rename 'libusb1_common' to 'libusb_helper' 34/5434/4
Marc Schink [Wed, 5 Feb 2020 15:07:48 +0000 (16:07 +0100)]
drivers: Rename 'libusb1_common' to 'libusb_helper'

The name 'common' does not make sense anymore. While at it,
remove some unnecessary #includes.

Change-Id: If9798a5cce179438d89428a598d8ca05c8e5f20c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5434
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agodrivers: libusb1_common code cleanup 33/5433/3
Marc Schink [Wed, 5 Feb 2020 14:50:31 +0000 (15:50 +0100)]
drivers: libusb1_common code cleanup

Remove unncessary wrapper functions and 'jtag_' prefixes.

Change-Id: I0fd866ff1e1cf7386c4d58a808dfda2c1c0a1518
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5433
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agotcl/target: Drop old Renesas Gen2 SoC configs 99/5399/7
Marek Vasut [Tue, 7 Jan 2020 21:53:28 +0000 (22:53 +0100)]
tcl/target: Drop old Renesas Gen2 SoC configs

Drop old Renesas Gen2 SoC configurations, as they were superseded by
the new unified config.

Change-Id: I7c2ccbdc13b01a552ce9cafdc1538f226beaa9f2
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5399
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoremove libusb0_common support 32/5432/5
Oleksij Rempel [Mon, 3 Feb 2020 18:44:40 +0000 (19:44 +0100)]
remove libusb0_common support

Supporting two libusb versions provides additional development challenges
without additional advantage. In most cases we need to patch libusb0_common and
libusb1_common without real ability to test libusb0_common.

Change-Id: Icbb19c6809b14533fe2acf7a877377b3be4cbd61
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/5432
Tested-by: jenkins
4 years agotcl/target: Switch Renesas R-Car Gen2 boards to new config 98/5398/7
Marek Vasut [Tue, 7 Jan 2020 21:54:32 +0000 (22:54 +0100)]
tcl/target: Switch Renesas R-Car Gen2 boards to new config

Switch Renesas R-Car Gen2 boards which are currently supported from
the old ad-hoc SoC configuration to the new unified configuration.

Change-Id: I8a67bceb3ae92d840ae4dbac20868c75e83f7d58
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5398
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agotcl/target: Add unified config for Renesas R-Car Gen2 targets 97/5397/7
Marek Vasut [Tue, 7 Jan 2020 21:49:45 +0000 (22:49 +0100)]
tcl/target: Add unified config for Renesas R-Car Gen2 targets

Add configuration for the Renesas R-Car Generation 2 targets.
These are SoCs with Cortex A15s and A7s. All cores currently
supported by OpenOCD are supported here as well as two new
cores, M2N and V2H, for the sake of support completeness.

Change-Id: Ib6fe70a91360b4f8bd69822ee28b6dea530cfa0a
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5397
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agotcl/target: Abort on invalid SoC selection on R-Car Gen3 39/5439/5
Marek Vasut [Thu, 6 Feb 2020 11:17:13 +0000 (12:17 +0100)]
tcl/target: Abort on invalid SoC selection on R-Car Gen3

Instead of printing error message and continue, abort on invalid SoC
selection right away.

Change-Id: I9c7a7111b590c6c49a0826562380b881a162a8dc
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5439
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/stm32h7x: add support of STM32H7Ax/H7Bx devices 41/5441/6
Tarek BOCHKATI [Thu, 6 Feb 2020 23:12:48 +0000 (00:12 +0100)]
flash/stm32h7x: add support of STM32H7Ax/H7Bx devices

this new device has the following features:
 - single core cortex-M7
 - 2MB flash - dual bank
    - page size 8k
    - write protection grouped by 4 sectors
    - write block size 128 bits (16 bytes)

the bit definition of FLASH_CR is different than STM32H74x,
that's why we introduced a helper to compute the FLASH_CR value

Change-Id: I4da10cde8dd215b1b0f2645f0efdba9d198038d1
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5441
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoAdd support for SAMD21E17D device 58/5458/3
Michael Stoll [Wed, 19 Feb 2020 16:32:26 +0000 (17:32 +0100)]
Add support for SAMD21E17D device

Change-Id: Id0a533f8899b20cc87e3a9143383ddf279c86301
Signed-off-by: Michael Stoll <michael.stoll@meadow-robotics.com>
Reviewed-on: http://openocd.zylin.com/5458
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotarget/arc: fix clang static analyzer warnings 80/5480/2
Evgeniy Didin [Fri, 28 Feb 2020 08:14:42 +0000 (11:14 +0300)]
target/arc: fix clang static analyzer warnings

Fixes:
* Removed typo in *bitfields initializations.
* Removed potentional memory leak allocating
  reg_data_type_struct_field/reg_data_type_flags_field objects.
* Initialize buffers with "0" before usage in buf_set_u32().
* Removed memory leak in jim_arc_add_reg().

Change-Id: Iefde57cd4a48c4f3350c376475df8642607f52ff
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5480
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoIntroduce ARCv2 architecture related code 32/5332/13
Evgeniy Didin [Mon, 27 Jan 2020 12:22:27 +0000 (15:22 +0300)]
Introduce ARCv2 architecture related code

This patch is an initial bump of ARC-specific code
which implements the ARCv2 target(EMSK board) initializing
routine and some basic remote connection/load/continue
functionality.

Changes:
03.12.2019:
-Add return value checks.
-Using static code analizer next fixes were made:
        Mem leak in functions:
                arc_jtag_read_memory,arc_jtag_read_memory,
                arc_jtag_write_registers, arc_jtag_read_registers,
                jim_arc_add_reg_type_flags, jim_arc_add_reg_type_struct,
                arc_build_reg_cache, arc_mem_read.
        Dead code in "arc_mem_read";
        In arc_save_context, arc_restore_context correct arguments
        in"memset" calls.
        In "build_bcr_reg_cache", "arc_build_reg_cache" check
        if list is not empty.

29.12.2019
-Moved code from arc_v2.c to arc.c
-Added checks of the result of calloc/malloc calls
-Reworked arc_cmd.c: replaced spagetty code with functions
-Moved to one style in if statements - to "if(!bla)"
-Changed Licence headers

22.01.2020
-Removed unused variables in arc_common
-Renamed register operation functions
-Introduced arc_deinit_target function
-Fixed interrupt handling in halt/resume:
        * add irq_state field in arc_common
        * fix irq enable/disable calls ( now STATUS32 register is used)
-Switched from buf_set(get)_us32() usage to target_buffer_set(get)_u32()
-Made some cleanup

30.01.2020
-Removed redundant arc_register struct, moved target link to arc_reg_desc
-Introduced link to BCR reg cache in arc_common for freeing memory.
-Now arc_deinit_target frees all arc-related allocated memory.
Valgrind shows no memory leaks.
-Inroduced arch description in arc.c

01.02.2020
-Remove small memory allocations in arc_init_reg. Instead created reg_value
and feature fields in arc_reg_desc.
-Add return value for arc_init_reg() func.
-Replaced some integer constants(61,62,63) with defines.
-Removed redundant conversions in arc_reg_get_field().
-Moved iccm/dccm configuration code from arc_configure()
to separate functions.

19.02.2020
-Change sizeof(struct) to sizeof(*ptr) in allocations
-Changed if/while(ptr != NULL) to if/while(ptr)
-Removed unused variables from struct arc_jtag
-Add additional structs to arc_reg_data_type
 to reduce amount of memory allocations calls
 and simplifying memory freeing.
-Add helper arc_reg_bitfield_t struct which includes
 reg_data_type_bitfield object and char[] name. Reduces
 memory allocations calls.
-Add limit for reg_type/reg_type_field names(20 symbols).
-Add in jim_arc_add_reg_type*() functions additional
 argnument checks(amount of field/name size).
-In jim_arc_add_reg_type*() reduced amount of memory allocations.
-Cleanup of jim_arc_add_reg_type*() functions.
-For commands update ".usage" fields according docopt.
-Cleanup in arc_jtag.c
-Renamed functions which require jtag_exeutre_queue() to arc_jtag_enque_*()
-Add arc_jtag_enque_register_rw() function, which r/w to jtag ir/dr regs
 during regiter r/w.

24.02:
-Change include guards in arc* files according coding style
-Remove _t suffix in struct arc_reg_bitfield_t
-Some cleanup

Change-Id: I6ab0e82b12e6ddb683c9d13dfb7dd6f49a30cb9f
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5332
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agocoding style: doc: remove empty lines at end of text files 70/5170/4
Antonio Borneo [Sun, 12 May 2019 10:52:59 +0000 (12:52 +0200)]
coding style: doc: remove empty lines at end of text files

Empty lines at end of text files are useless.
Remove them.

Change-Id: I30e4d3d03c4ce846aa7bcefa7366f88732275557
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5170
Tested-by: jenkins
4 years agocoding style: testing: remove empty lines at end of text files 69/5169/4
Antonio Borneo [Sun, 12 May 2019 10:51:28 +0000 (12:51 +0200)]
coding style: testing: remove empty lines at end of text files

Empty lines at end of text files are useless.
Remove them.

Change-Id: Id05a7bd944edccaa03ed9eb48599b2e262664cf0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5169
Tested-by: jenkins
4 years agocoding style: tools: remove empty lines at end of text files 68/5168/4
Antonio Borneo [Sun, 12 May 2019 10:38:18 +0000 (12:38 +0200)]
coding style: tools: remove empty lines at end of text files

Empty lines at end of text files are useless.
Remove them.

Change-Id: Iea4c8425e137d6252fb2e5b62e0b124c73a01cb6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5168
Tested-by: jenkins
4 years agocoding style: add newline at end of text files 67/5167/5
Antonio Borneo [Sun, 12 May 2019 10:26:46 +0000 (12:26 +0200)]
coding style: add newline at end of text files

Some text file is missing newline at EOF.
Add it.

Change-Id: Ieebc790096f40961283c644642e56fde975e957f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5167
Tested-by: jenkins
4 years agocoding style: fix space around pointer's asterisk 97/5197/4
Antonio Borneo [Sun, 5 May 2019 19:26:56 +0000 (21:26 +0200)]
coding style: fix space around pointer's asterisk

The script checkpatch available in new Linux kernel offers an
experimental feature for automatically fix the code in place.
While still experimental, the feature works quite well for simple
fixes, like spacing.

This patch has been created automatically with the script under
review for inclusion in OpenOCD, using the command
find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types POINTER_LOCATION --fix-inplace -f {} \;
then manually reviewed.

OpenOCD coding style does not mention the space around pointer's
asterisk, so no check is enforced. This patch only makes the style
uniform across the files.

The patch only changes amount and position of whitespace, thus
the following commands show empty diff
git diff -w
git log -w -p
git log -w --stat

Change-Id: Iefb4998e69bebdfe0d1ae65cadfc8d2c4f166d13
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5197
Tested-by: jenkins
4 years agolog: let command "log_output" to set back its default 33/5233/3
Antonio Borneo [Fri, 14 Jun 2019 08:00:06 +0000 (10:00 +0200)]
log: let command "log_output" to set back its default

The default log output is stderr. After the command "log_output"
has been used to set an output log file, it is possible to return
back to stderr only on *NIX hosts specifying a new log output file
as "/dev/stderr", but this is not intuitive, not documented and
not portable out of *NIX.

Make command "log_output" able to set back the default output to
stderr when the parameter is either "default" or is missing.
While there, add debug message to log the change and make the
command return error on incorrect syntax.

Change-Id: I8c7c929780f58e2c23936737c8e7274a96734786
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5233
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoadi_v5_dapdirect: fix connect under reset 15/5415/3
Antonio Borneo [Thu, 23 Jan 2020 14:18:33 +0000 (15:18 +0100)]
adi_v5_dapdirect: fix connect under reset

Deassert the reset only if connect under reset is not required;
otherwise, assert the reset.
This fix aligns the behavior of connect under reset in dapdirect
with the behavior in jtag and swd.

Change-Id: I937ef4320b44e51ef6cb0e349e12348dbfbe4abb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5415
Tested-by: jenkins
4 years agoflash/nor/stm32l4x: Minor code cleanups 49/5449/2
Marc Schink [Mon, 10 Feb 2020 14:37:45 +0000 (15:37 +0100)]
flash/nor/stm32l4x: Minor code cleanups

Change-Id: I3053bbe888ac1f0a0593ef51bf9ca564f1cc27ec
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5449
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agoflash/nor/stm32h7x: Minor code cleanups 48/5448/2
Marc Schink [Mon, 10 Feb 2020 14:39:19 +0000 (15:39 +0100)]
flash/nor/stm32h7x: Minor code cleanups

Change-Id: Ia212b1877abeda27f507de29a3aee2b171c1b8c6
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5448
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Christopher Head <chead@zaber.com>
4 years agoSupport bitbanging on 64-bit ARM CPUs. 74/5274/2
Mara Bos [Fri, 9 Aug 2019 09:59:24 +0000 (11:59 +0200)]
Support bitbanging on 64-bit ARM CPUs.

The configure.ac file restricted this to only 'arm' CPUs, but
${host_cpu} is 'aarch64' (not 'arm') for 64 bit ARM CPUs.

Tested on a Raspberry Pi compute module 3.

Change-Id: I6cb1d7e7fadc51dbb12419176f1faf0a0cb0b228
Signed-off-by: Mara Bos <m-ou.se@m-ou.se>
Reviewed-on: http://openocd.zylin.com/5274
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agotcl/board: update ST NUCLEO-H745ZI-Q configuration file to use dapdirect 16/5316/3
Tarek BOCHKATI [Wed, 12 Feb 2020 11:14:06 +0000 (12:14 +0100)]
tcl/board: update ST NUCLEO-H745ZI-Q configuration file to use dapdirect

this board embeds and STLINK DAP capable firmware

Change-Id: I276e9f44ad6cf7d1ff664898bbc884676bdbc967
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5316
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agotarget/adi_v5_swd: fix clang static analyzer warning 74/5374/3
Tomas Vanek [Fri, 20 Dec 2019 22:41:55 +0000 (23:41 +0100)]
target/adi_v5_swd: fix clang static analyzer warning

Change-Id: I24b3e74b62fad469e3150ad97a10a9ab69c2793b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5374
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor/tcl.c: add filld command to write double-word with 64-bit value 43/5443/2
Tarek BOCHKATI [Fri, 7 Feb 2020 17:36:29 +0000 (18:36 +0100)]
flash/nor/tcl.c: add filld command to write double-word with 64-bit value

Change-Id: I2eeda7af7d855ed1284083d025994f8fa9531969
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5443
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoflash/nor/stm32l4x: lock flash after error 61/5361/4
Tomas Vanek [Sat, 14 Dec 2019 18:37:41 +0000 (19:37 +0100)]
flash/nor/stm32l4x: lock flash after error

Also add locking after option write, it was missing at all.

Change-Id: I0227c6a74866f0fe8e40aa58616f0b3115ad5af0
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5361
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
4 years agotcl/board: Add imx8mp-evk 27/5427/3
Leonard Crestez [Sat, 1 Feb 2020 00:02:04 +0000 (02:02 +0200)]
tcl/board: Add imx8mp-evk

Board includes an internal adapter (interface/ftdi/imx8mp-evk.cfg) and a
standard external ARM-10 connector.

Change-Id: Ibb301011665b1edfb95be1213d8100143f6839dd
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5427
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotcl/interface/ftdi: Add imx8mp-evk internal JTAG interface 26/5426/3
Leonard Crestez [Fri, 31 Jan 2020 23:53:35 +0000 (01:53 +0200)]
tcl/interface/ftdi: Add imx8mp-evk internal JTAG interface

The imx8mp-evk board has a FT4232H chip connected to the chip's JTAG
pins.

Switching between this on-board interface and the external ARM-10
connector is controlled by an GPIO which is behind an i2c expander
connected to the same FTDI chip.

Switching can be performed using the NXP bcu tool:

https://github.com/NXPmicro/bcu

Change-Id: Ic910515f76eaf09ea6d0f755b026fb09cf09ccfc
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5426
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoflash/stm32h7x: use alignment infrastructure 88/5388/5
Christopher Head [Fri, 3 Jan 2020 22:49:16 +0000 (14:49 -0800)]
flash/stm32h7x: use alignment infrastructure

Report the 32-byte alignemnt requirement via the bank structure rather
than enforcing it ad-hoc in the write routine. This allows people to do
non-32-byte-aligned writes if they want, with the infrastructure fixing
up the addresses passed to the low-level driver.

Change-Id: I2c4f532f2000435954a900224dbc9f2c30d1cc94
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5388
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoflash/nor/stm32f1x: Some small code cleanups 04/5404/6
Marc Schink [Sun, 19 Jan 2020 15:56:16 +0000 (16:56 +0100)]
flash/nor/stm32f1x: Some small code cleanups

Change-Id: I1fc08b96b179a1376af233b713ae50d6ad7867a0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5404
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
4 years agoflash/nor/stm32h7x: check OPTCHANGEERR 18/5418/2
Christopher Head [Mon, 27 Jan 2020 22:48:15 +0000 (14:48 -0800)]
flash/nor/stm32h7x: check OPTCHANGEERR

Without this, a failed attempt to change option bytes will silently
appear to succeed but without actually changing the option bytes
(confusingly, the option bytes will still read back as if they had been
changed until a reboot as well!).

Change-Id: Id529c6c384a8a16be75f5702310670d99d8fac79
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5418
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
4 years agoflash/nor/stm32h7x: fix incorrect array indexing 17/5417/2
Christopher Head [Mon, 27 Jan 2020 21:30:04 +0000 (13:30 -0800)]
flash/nor/stm32h7x: fix incorrect array indexing

Change-Id: Iec2246df284953d1442dfefdad8e70041690dfe2
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5417
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
4 years agostlink: add trace support in DAP direct mode 09/5409/3
Antonio Borneo [Thu, 18 Jul 2019 13:14:34 +0000 (15:14 +0200)]
stlink: add trace support in DAP direct mode

Reuse the existing tracing functionality of HLA mode to support
tracing in DAP direct mode.

Change-Id: I75a01e88ba5d3e45717e4108b99697ac3225db9e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5409
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoarmv8: check the core state to pass the correct arch to gdb 34/5234/2
Antonio Borneo [Fri, 14 Jun 2019 13:59:17 +0000 (15:59 +0200)]
armv8: check the core state to pass the correct arch to gdb

Commit 3799eded6761 ("target/aarch64: add support for
multi-architecture gdb") passes the constant string "aarch64" as
architecture to gdb. This is not working if the core is running
in 32 bits mode; gdb reports:
Truncated register 8 in remote 'g' packet
then closes the connection with OpenOCD.

Make the architecture string dependant from the current state of
the core.

Change-Id: I16e1614ea02ba29bf87f450b3dfe25c83c9a3612
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5234
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
4 years agocoding style: use ARRAY_SIZE() when possible 98/5198/3
Antonio Borneo [Mon, 6 May 2019 10:50:44 +0000 (12:50 +0200)]
coding style: use ARRAY_SIZE() when possible

We have the macro ARRAY_SIZE() already available. Use it!

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types ARRAY_SIZE -f {} \;

Change-Id: Ic7da9b710edf118eacb08f9e222f34208c580842
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5198
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agocoding style: remove unnecessary parentheses 96/5196/3
Antonio Borneo [Mon, 6 May 2019 09:29:17 +0000 (11:29 +0200)]
coding style: remove unnecessary parentheses

Identified by checkpatch script from Linux kernel v5.1 using the
command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types UNNECESSARY_PARENTHESES -f {} \;

then fixed manually.

Change-Id: Ia2d9a0953d9b89fc87dc1195aa05c7f63c068c48
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5196
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agojtag/startup.tcl: remove trailing whitespaces 94/5194/2
Antonio Borneo [Mon, 6 May 2019 13:15:54 +0000 (15:15 +0200)]
jtag/startup.tcl: remove trailing whitespaces

Change-Id: I1d6f4f47ee6f8985c84ddb2647e029c5f4e6a55a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5194
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
4 years agotarget/nds32: fix type of magic number 93/5193/2
Antonio Borneo [Mon, 6 May 2019 09:40:17 +0000 (11:40 +0200)]
target/nds32: fix type of magic number

The macro NDS32_COMMON_MAGIC was cast-ed to int to avoid compile
time error for comparison type mismatch while comparing it with
the field common_magic.
This is incorrect because the macro value is a 32 bit unsigned
value; better changing the type of the field common_magic to keep
the unsigned value.

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types TYPECAST_INT_CONSTANT -f {} \;

Change-Id: Ib5924b6cecdffe70ab5c78d3b30a9c8e4deb7c7b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5193
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoflash/nor/stm32lx: Minor code cleanups 38/5438/2
Marc Schink [Thu, 6 Feb 2020 10:02:25 +0000 (11:02 +0100)]
flash/nor/stm32lx: Minor code cleanups

Change-Id: I6440a4eb1f65a2f8ae2914b38f21a59955e85e0d
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5438
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agojtag_vpi: added an option to stop simulation on exit 07/5407/4
Jan Matyas [Wed, 22 Jan 2020 07:50:36 +0000 (08:50 +0100)]
jtag_vpi: added an option to stop simulation on exit

Command CMD_STOP_SIMU had been defined in jtag_vpi for a long time
(since the beginning?) but has not been utilized until now.
Its purpose is to signal to the jtag_vpi server (i.e. the RTL
simulation software) that the simulation shall be stopped.

This commit adds a TCL configuration command that selects whether
CMD_STOP_SIMU will be sent to the jtag_vpi server when OpenOCD is
about to exit. This functionality is off by default to maintain
identical behavior as in previous OpenOCD versions, unless the user
enables it explicitly.

Change-Id: If3894af6efa61038ccf6c9191f664e2128f2ef11
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/5407
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agoInclude start-of-region address 99/4799/2
Piotr Kasprzyk [Sat, 8 Dec 2018 17:02:11 +0000 (18:02 +0100)]
Include start-of-region address

When $ADDRESS == $BASE that address used to be excluded.

After this commit $ADDRESS == $BASE is within the range.

Now the rule for "iswithin" is:
$BASE <= $ADDRESS < ($BASE + $LEN)

Thanks to Antonio Borneo <borneo.antonio@gmail.com> for noticing this.

Change-Id: I74373c6010e069372d886fa7ecd8120892616834
Signed-off-by: Piotr Kasprzyk <ciri@ciri.pl>
Reviewed-on: http://openocd.zylin.com/4799
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agoflash/stm32lx: mention explicitly that this driver covers STM32 L0 and L1 37/5437/3
Tarek BOCHKATI [Wed, 5 Feb 2020 18:00:46 +0000 (19:00 +0100)]
flash/stm32lx: mention explicitly that this driver covers STM32 L0 and L1

this is to avoid confusion with STM32 L4, L4+ and L5 families

also:
 - a warning message is changed to error
 - stm32l0x and stm32l1x aliases has been created to permit
   the usage of either names

Change-Id: If3f16d2a3b7d1369959aa7407da37a9076ea91d7
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5437
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoflash/startup.tcl: update stm32 flash driver aliases 36/5436/3
Tarek BOCHKATI [Wed, 5 Feb 2020 17:21:15 +0000 (18:21 +0100)]
flash/startup.tcl: update stm32 flash driver aliases

This will enable us to use either name when calling flash driver commands.

For example the stm32wbx family use the same flash driver as the stm32l4x, so
the user has to use 'stm32l4x lock 0' which can be confusing.
Now the user can also use 'stm32wbx lock 0' with the same result.

Change-Id: Ic0d8da9afc202d7cc82d9b9949827e958a1cc824
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5436
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agojtag: Fix copy-paste error in 'irscan' help 46/5446/2
Marek Vasut [Sat, 8 Feb 2020 07:58:53 +0000 (08:58 +0100)]
jtag: Fix copy-paste error in 'irscan' help

Replace "Instruction Register (DR)" with "Instruction Register (IR)",
that is sed "s@DR@IR@", which was likely a copy-paste error.

Change-Id: I3e625872c855d655485b3efa5f50fe1c00ecbf52
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5446
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
4 years agotcl: Remove executable bit 19/5419/2
Marc Schink [Tue, 28 Jan 2020 13:54:19 +0000 (14:54 +0100)]
tcl: Remove executable bit

Change-Id: Ib452435b13c3cb8d14453d983151936238b9601d
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5419
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agoefm32: add EFR32ZG13P and EFR32ZG14P parts 64/5364/2
Frank Hunleth [Tue, 17 Dec 2019 20:06:09 +0000 (15:06 -0500)]
efm32: add EFR32ZG13P and EFR32ZG14P parts

This adds the EFR32 Zen Gecko Family parts. The device family values are
found in table 4.7.11 of
https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdf.

Change-Id: I3858b7ba815784b1150e2214a2833e8ff7d249e1
Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
Reviewed-on: http://openocd.zylin.com/5364
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
4 years agostlink: fix max packet size for 8 bit R/W on stlink-v3 08/5408/2
Antonio Borneo [Mon, 6 Jan 2020 11:35:17 +0000 (12:35 +0100)]
stlink: fix max packet size for 8 bit R/W on stlink-v3

While ST internal documentation for STLINK-V3 reports that 8 bits
read/write commands handle 512 bytes of data, a firmware bug makes
it crashing on high data size.
This is fixed with firmware V3J6 (shipped together with V2J36).

Check for firmware version to use the proper data size.

Change-Id: Iaba6cd26bbe130097c1c19de610680e0e8b69bfc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/259/
Reviewed-on: http://openocd.zylin.com/5408
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agojtag: flush jtag queue after jtag_add_tlr() 05/5405/2
Antonio Borneo [Wed, 2 Oct 2019 16:21:05 +0000 (18:21 +0200)]
jtag: flush jtag queue after jtag_add_tlr()

If the TLR sequence is sent as result of the command "adapter
assert trst" while polling is off, the TLR sequence is not sent out
until a following jtag operation.

Flush the jtag queue before return.

Change-Id: I20efd7137cb7b1d1c4f73c1362cbe4e57aeaae49
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5405
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agoSwitch to HTTPS for submodules 06/5406/3
Christopher Head [Tue, 21 Jan 2020 20:44:46 +0000 (12:44 -0800)]
Switch to HTTPS for submodules

repo.or.cz already redirects HTTP requests to HTTPS. There is therefore
no possible benefit to keeping the submodule URLs using HTTP—anyone who
can’t access via HTTPS will fail anyway, immediately after the redirect.
Changing the submodule URLs eliminates one unnecessary HTTP request and,
more importantly, eliminates SSLStrip-style attacks.

Change-Id: I9faf1ec8aa87bcfd1acafe2c445a0baf2abfbd09
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5406
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotcl: fix remaining scripts after rework adapter commands 24/5424/2
Antonio Borneo [Thu, 30 Jan 2020 17:11:54 +0000 (18:11 +0100)]
tcl: fix remaining scripts after rework adapter commands

Some script have been added or modified after the patches for
reworking the adapter commands were pushed in gerrit.
Such scripts use the old command syntax and trigger a "deprecated"
warning at runtime.

Fix them with the same sed commands used for the other scripts:
sed -i 's/^interface /adapter driver /' $(find tcl/ -type f)
sed -i 's/adapter_khz/adapter speed/g' $(find tcl/ -type f)
sed -i 's/adapter_nsrst_delay/adapter srst delay/g' $(find tcl/ -type f)
sed -i 's/adapter_nsrst_assert_width/adapter srst pulse_width/g' $(find tcl/ -type f)

Change-Id: I0824d6c506a9af3eb9129b74c02a92b4eb1b100d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5424
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
4 years agotcl: Add interface config for isodebug isolated JTAG/SWD+UART 51/5251/4
Andreas Fritiofson [Fri, 28 Jun 2019 13:45:23 +0000 (15:45 +0200)]
tcl: Add interface config for isodebug isolated JTAG/SWD+UART

Currently only used internally at Unjo.

Change-Id: I7786e95e1bd755a73156ecad5b6d7f6273d8ddef
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/5251
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agojtag: drivers: xlnx-pcie-xvc: fix build on Linux pre v4.10 35/5435/2
Antonio Borneo [Wed, 5 Feb 2020 17:00:12 +0000 (18:00 +0100)]
jtag: drivers: xlnx-pcie-xvc: fix build on Linux pre v4.10

The macro PCI_CFG_SPACE_EXP_SIZE is exposed to userspace from
Linux kernel v4.10, with commit cc10385b6fde ("PCI: Move config
space size macros to pci_regs.h")
http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc10385b6fde

Define the macro in the driver code, if not already defined.

Change-Id: I610219a2587eff2c142102b9f7830e3da882af78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5435
Reviewed-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
4 years agoflash/nor: Add Renesas RPC HF driver 49/5149/20
Marek Vasut [Sat, 13 Apr 2019 20:44:45 +0000 (22:44 +0200)]
flash/nor: Add Renesas RPC HF driver

Add driver for the RPC block in HF mode on Renesas R-Car Gen3 SoCs.
This driver allows operating the on-SIP HF memory.

Note that HF is CFI compliant flash, but it is not memory mapped,
hence the need to replace all the memory accessors and read/write
functions. The write function is entirely replaced to increase
performance and is Spansion/AMD specific, since there is no known
SIP with other HF from another vendor.

Add the following two lines to board TCL file to bind the driver on
R-Car Gen3 SoC using HyperFlash:

  set _FLASHNAME $_CHIPNAME.flash
  flash bank $_FLASHNAME rpchf 0x08000000 0x4000000 2 2 $_CHIPNAME.a57.0

Change-Id: Ie18729d017eeb46e1363333ffe002d010dfc5ead
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5149
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor: Export various functions from the CFI core 48/5148/19
Marek Vasut [Sat, 13 Apr 2019 20:44:45 +0000 (22:44 +0200)]
flash/nor: Export various functions from the CFI core

Export various functions needed by other driver, specifically the
upcoming Renesas RPC HF driver. No functional change.

Change-Id: I551258979a7221288fb4f4382f857db5cfe0b0de
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5148
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agojtag: Fix jtag_reset fallback 16/5416/2
Leonard Crestez [Mon, 27 Jan 2020 18:10:30 +0000 (20:10 +0200)]
jtag: Fix jtag_reset fallback

The fallback provided for the jtag_reset command always fails with a
strange message: 'Error: invalid command name "de"'

This is caused by incorrect quoting inside the warning message.

Fixes: c07b774e8f49 ("jtag: replace command "jtag_reset" with "adapter [de]assert"")
Change-Id: Icd47fca2b5a7b33474bfb0040e88193a0968f301
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5416
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 years agotcl: replace the deprecated commands with "adapter ..." 84/5284/5
Antonio Borneo [Fri, 23 Aug 2019 13:51:00 +0000 (15:51 +0200)]
tcl: replace the deprecated commands with "adapter ..."

Avoid annoying "deprecated" messages while running the scripts
distributed with OpenOCD code.
Change automatically created with commands
sed -i 's/adapter_khz/adapter speed/g' $(find tcl/ -type f)
sed -i 's/adapter_nsrst_delay/adapter srst delay/g' $(find tcl/ -type f)
sed -i 's/adapter_nsrst_assert_width/adapter srst pulse_width/g' $(find tcl/ -type f)

Minor indentation issue fixed manually in
tcl/board/at91sam9g20-ek.cfg
tcl/target/at91sam9260_ext_RAM_ext_flash.cfg

Change-Id: I425fd56c0c88cd6b06124621306eeb89166dfe71
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5284
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agodoc: replace example command "interface" with "adapter driver" 85/5285/3
Antonio Borneo [Fri, 23 Aug 2019 14:07:12 +0000 (16:07 +0200)]
doc: replace example command "interface" with "adapter driver"

Keep documentation consisted after commands renaming.

Change-Id: I97b43887cae9d7c224b07e4ba0b7d04915a19fc4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5285
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agotcl: replace command "interface" with "adapter driver" 83/5283/4
Antonio Borneo [Fri, 23 Aug 2019 13:49:58 +0000 (15:49 +0200)]
tcl: replace command "interface" with "adapter driver"

Avoid annoying "deprecated" messages while running the scripts
distributed with OpenOCD code.
Change automatically created with command
sed -i 's/^interface /adapter driver /' $(find tcl/ -type f)

Change-Id: I2291dfb96e164beecbeb3366ce83f9df2ad6c197
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5283
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoopenocd: fix minor inconsistencies after renaming "adapter" command 82/5282/3
Antonio Borneo [Fri, 23 Aug 2019 13:12:57 +0000 (15:12 +0200)]
openocd: fix minor inconsistencies after renaming "adapter" command

Replace in the code any reference to the deprecated commands.

Change-Id: I75d28064017d664990b4024967900f32e196230a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5282
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agomove ftdi_location deprecation helper to proper place 78/5278/3
Oleksij Rempel [Wed, 14 Aug 2019 11:17:51 +0000 (13:17 +0200)]
move ftdi_location deprecation helper to proper place

Change-Id: I927d4e918acbf321aea1dd7a8de95fbaa8fbbbf0
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/5278
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 years agojtag: adapter: rework adapter related commands 74/4774/9
Oleksij Rempel [Mon, 19 Nov 2018 11:56:48 +0000 (12:56 +0100)]
jtag: adapter: rework adapter related commands

currently we have different types of same command group:
- starting with adapter_*
- starting with interface*
- without adapter or interface prefix.

Since interface name is already used, we can only use "adapter" command
group by keeping old commands as well.

Change-Id: Id0a1cb63a2ea6860c67ae1e7a3a06a37ddf464f4
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/4774
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
4 years agoflash/nor/stm32l4x: fix minor errors in flash write/async algo 60/5360/4
Tomas Vanek [Sat, 14 Dec 2019 17:55:01 +0000 (18:55 +0100)]
flash/nor/stm32l4x: fix minor errors in flash write/async algo

Fix comment of tested errors in asm src.

List all relevant errors in FLASH_ERROR mask: FLASH_PROGERR was missing
and any trial to re-program already programmed double word ended up
in the error bit held uncleared and flash write permanetly repeating
the error message until reset.

Lock the bank also after unsuccesfull write_block run.

Set async target algo block size to size of double word.

Remove warning in case of write_block success. In case of error
use LOG_ERROR instead of warning.

Change-Id: Ibf6d5e306a4c2eaa43de67d636b4902c737f02f3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5360
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)