Commit Graph

10681 Commits

Author SHA1 Message Date
R. Diez 9ff79fd61f enable the Bus Pirate adapter by default on most systems
Also convert the Bus Pirate to the common PROCESS_ADAPTERS logic.

Change-Id: Ifa8ebcee380c16d7e308ba7a75dbffdb74208285
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8533
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Tested-by: jenkins
2024-11-23 13:49:42 +00:00
Antonio Borneo c582cfbf75 driver: stlink: get adapter speed through adapter_get_speed_khz()
The stlink driver, both in dapdirect and in HLA modes, pretends to
store locally the value of the adapter speed in order to use it
later-on during adapter initialization.
It doesn't work in dapdirect mode since the code to store locally
the value will not be executed until the adapter is already fully
initialized.

This cause an issue in dapdirect mode:
- due to the local value, still kept at -1, the adapter will be
  initialized to the lowest clock speed (5 KHz on stlink v2 in SWD
  mode);
- after the adapter initialization the framework will again set
  the speed with the value requested by the user.

Some target, like nRF51822, only accepts JTAG/SWD speed in a
defined range of frequencies. The initial speed of 5 KHz used by
dapdirect can be out of range, making the target debug port not
working.

The adapter framework already stores the value of speed and makes
it available through adapter_get_speed_khz().

Drop struct hl_interface_param::initial_interface_speed.
Let the code to use adapter_get_speed_khz().

Change-Id: Ie11bf0234574f2a9180d3d3a16efb78e08dfcd86
Reported-by: Andrzej Sierżęga <asier70@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8574
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
Tested-by: jenkins
2024-11-23 13:49:16 +00:00
Marc Schink 8c739a45a0 helper/jim-nvp.h: Rework 'isconfigure' variable
Change the variable name to 'is_configure' to be compatible with the
coding style and use 'bool' as data type.

Change-Id: I8609f9807c8bd14eaf6c93acf63fd51b55c9bbbb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8573
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:48:52 +00:00
Antonio Borneo 61fbcbeca8 semihosting: make local functions static
The functions:
- semihosting_opcode_to_str();
- semihosting_write_fields();
- semihosting_set_field();
are not referenced outside the file.

Make them static.

Change-Id: Ia8d35554673145fdfe0e501543eb18919863039f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8551
Tested-by: jenkins
2024-11-23 13:48:25 +00:00
Antonio Borneo b04a58e3fc target: esirisc: make local functions static
The function esirisc_jtag_get_eid() is not used outside the file.
Make it static.

The function esirisc_jtag_disable_debug() is never used.
Make it static and mark it as unused.

Change-Id: I5c99cbf77cc9c527b6e18a3f67caa24f8551d09c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8550
Tested-by: jenkins
2024-11-23 13:48:12 +00:00
Antonio Borneo df42faf51d target: aarch64: drop unused armv8_mmu_translate_va()
The function is not used.
Drop it!

Change-Id: I1625e03714b5a842f668098191c39cce34f815e8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8549
Tested-by: jenkins
2024-11-23 13:47:55 +00:00
Antonio Borneo c5babec794 target: x86_32: make x86_32_common_read_io() static
The function is not referenced outside the file.
Make it static.

Change-Id: Ic2552c040b6b46c0334851a4fc0fdaa400e11e4c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8548
Tested-by: jenkins
2024-11-23 13:47:33 +00:00
Antonio Borneo f3aeb3d676 target: dsp563xx: make dsp563xx_once_reg_read_ex() static
The function is not referenced outside the file.
Make it static.

Change-Id: Ifeccc5e38f3da4b4111422860bc1c1447d00f7fe
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8547
Tested-by: jenkins
2024-11-23 13:47:15 +00:00
Antonio Borneo a34d4b8cb4 pld: make get_pld_device_by_num() static
The function is not referenced outside the file.
Make it static.

Change-Id: I5f2a2c70085b9158df8806432bb9ed09bb256ab5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8546
Tested-by: jenkins
2024-11-23 13:46:59 +00:00
Antonio Borneo 4da8f6d27a rtt: drop unused function rtt_started()
The function is not used.
Drop it!

Change-Id: I176c9d6ba077e36b762c14f9b877d5152992763c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8545
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-11-23 13:46:35 +00:00
Antonio Borneo 644742b4b2 driver: mpsse: make local functions static
The functions:
- mpsse_divide_by_5_config();
- mpsse_purge();
- mpsse_rtck_config();
- mpsse_set_divisor();
are not referenced outside the file.

Make them static.

Change-Id: Id6930183a3ce26693b2113f622046168ba289df8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8544
Tested-by: jenkins
2024-11-23 13:46:20 +00:00
Antonio Borneo f4ac0c7022 jtag: driver: make local functions static
The functions:
- interface_jtag_add_callback();
- interface_jtag_add_callback4();
are not referenced outside the file.

Make them static.

Change-Id: I84f738309d23c8d0b5329aa04436db750cf185e5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8543
Tested-by: jenkins
2024-11-23 13:46:01 +00:00
Antonio Borneo f82664ff82 jtag: core: make local functions static
The functions:
- jtag_error_clear();
- jtag_tap_count();
are not referenced outside the file.

Make them static.

Change-Id: I00fcf06b1838b9f6c955c19772f1d41d486459e9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8542
Tested-by: jenkins
2024-11-23 13:45:42 +00:00
Antonio Borneo 2465f18515 adapter: make adapter_config_khz() static
The function is not referenced outside the file.
Make it static.

Change-Id: I72e96624749ae4cc7f4566d737a88186e899616a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8541
Tested-by: jenkins
2024-11-23 13:45:19 +00:00
Antonio Borneo 989e9e8b54 gitignore: drop ignoring files not generated anymore
With the drop of the code for the probe zy1000 [1] and then the
drop of minidriver code [2], there are no more auto-generated
source files.

Remove them from the list of generated files to be ignored.

Change-Id: Iee65e21528674ea4cc94018e52126f882da4f07c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
[1] b0fe92dba7 ("zy1000: drop the code, deprecated in v0.10.0")
[2] 25218e8935 ("jtag: remove minidriver code and minidriver-dummy")
Reviewed-on: https://review.openocd.org/c/openocd/+/8522
Tested-by: jenkins
2024-11-23 13:41:02 +00:00
Antonio Borneo 8a37230226 checkpatch: exclude gerrit's Change-Id line from commit description
Checkpatch rejects patches that have empty commit description and
logs them with:
	WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one
But if the patch has a gerrit's Change-Id line placed before the
line Signed-off-by, then checkpatch considers the Change-Id line
as a valid commit description text.

Use the Change-Id tag as a marker of the end of the commit message,
thus not counting its line as part of the commit description.

This patch is not relevant for the Linux kernel development process
as gerrit is not involved and the Change-Id tag is rejected. But
other projects, like OpenOCD, base the development on gerrit and
reuse kernel's checkpatch with flag '--ignore GERRIT_CHANGE_ID'.

This patch has been refused [1] in Linux upstream because it has
not been considered relevant for that project.
Let's take it as another add-on in OpenOCD checkpatch.

Change-Id: I3b55b8fffa07ce67177c108e7c9554ca46674246
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://lore.kernel.org/lkml/20230410100255.16755-1-borneo.antonio@gmail.com/
Reviewed-on: https://review.openocd.org/c/openocd/+/8539
Tested-by: jenkins
2024-11-16 14:25:35 +00:00
R. Diez 6d60ac5c08 Make bootstrap more robust
Change-Id: I67cc22752b34dd49c277e247f0b648047927a02b
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8532
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-16 14:20:48 +00:00
R. Diez 564b24e7f8 Makefile.am: generate ChangeLog with git log instead of git2cl
git log is faster than git2cl and the result has a better format.

Change-Id: I465ca62e3e30fed230fe9661e82a987980c05459
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8531
Tested-by: jenkins
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-16 14:20:06 +00:00
Jan Matyas d4a64e3f38 autoconf: Add support for code coverage
Add support for code coverage collection. This helps
developers to check if their test scenarios really exercised
all the OpenOCD functionality that they intended to test.

- Option --enable-gcov has been added to configure.ac
  which enables the coverage collection using Gcov. (Disabled
  by default.)

- The steps to collect and inspect the coverage have been
  described in HACKING file.

Change-Id: I259e401937a255e7ad7f155359a0b7787e4d0752
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8521
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-16 14:18:57 +00:00
Evgeniy Naydanov fd62626dff target/breakpoints: fix types in `watchpoint_add_internal()`
There was a conflict:
1. commit 2cd8ebf44d ("breakpoints: use 64-bit type for watchpoint mask
   and value")
2. commit 0bf3373e80 ("target/breakpoints: Use 'unsigned int' for
   length")

The second commit was created erlier, but merged later so the types of
`mask` and `value` became `uint32_t` in `watchpoint_add_internal()`.

This created a bug:
`WATCHPOINT_IGNORE_DATA_VALUE_MASK` is defined as `(~(uint64_t)0)`.
Truncation to uint32_t makes it so the comparisons with the constant
don't work.

Change-Id: I19c414c351f52aff72a60330d83c29db7bbca375
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8500
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Karl Palsson <karlp@tweak.au>
2024-11-11 17:33:56 +00:00
Marek Kraus b68d23da3c tcl/target/bl702: implement full software reset
In previous implementation, it was known that it does not perform
full reset, and that some peripherals, such as GLB core,
which handles among other stuff GPIOs, was not reset.

It was presumed, that full reset by software is not possible,
although, by accident, even when comment says that
CTRL_PWRON_RESET is set to 1, it is not
(value written into 0x40000018 supposed to be 0x7, not 0x6).

CTRL_PWRON_RESET indeed triggers full "power-on like" reset,
so this method is implemented in this commit.
There are some workarounds to make reset seamless, without any
error messages, which are described in comments of TCL script.

Only down-side of this reset is, that chip is halted after reset
bit later in BootROM than previous implementation,
but it's still good.

Change-Id: Ife2cdcc6a2d96a2e24039bfec149705baf046318
Signed-off-by: Marek Kraus <gamelaster@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8529
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-09 21:06:05 +00:00
Mark Zhuang bcebc84882 contrib: convert 'unsigned' to 'unsigned int'
Conversion done with
        checkpatch --fix-inplace -types UNSPECIFIED_INT

Change-Id: I0e31f87d437fcf3503736474f10a63f9c6be242b
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8368
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-09 21:05:18 +00:00
MicBiso 40d58ce529 tcl/target/renesas_rz_g2: Rename to renesas_rz and add RZ/V2L-G3S
Rename file to get it more generic and add more targets belonging
to the same family.
Add support for two new devices: RZ/V2L and RZ/G3S

Change-Id: Idb7f4d81d2f95ad15ef686e940f43ed29f49f343
Signed-off-by: MicBiso <michele.bisogno.ct@renesas.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8211
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:06:37 +00:00
Marc Schink 3b261fb155 adapter/parport: Coding style changes
Apply some coding style changes according to the C style guide. The
patch is tested for regression with the 'wiggler' parallel port cable.

Change-Id: I43774f596831d8c46f90f18893418178041a930b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8516
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:06:05 +00:00
Marc Schink 337db329c9 adapter/bitbang: Use 'bool' data type for blink()
Change-Id: I187f8944ad5fd92f28cbd32e447f9ec1a97e16d6
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8515
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:05:37 +00:00
Marc Schink f4d81cd4d4 tcl/interface: Restructure parport config files
Provide cable specific configuration files like for the FTDI interface.
Depcrecate the old configuration files but keep them until the next
release for compatibility reasons.

Change-Id: I436bd60779a107120c9e1b1f0b8a69a39a240ad4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8514
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:04:44 +00:00
Mark Zhuang 99f60d5e59 jtag: convert 'unsigned' to 'unsigned int'
Conversion done with
        checkpatch --fix-inplace -types UNSPECIFIED_INT

Change-Id: I2c2d56aa98e89bcc6088a1bd51d70066d67d6dad
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8367
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:03:37 +00:00
Mark Zhuang b95633b30c flash: convert 'unsigned' to 'unsigned int'
Change-Id: I8e8da78385eed714524891b580e19a79cfb459d3
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8370
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:03:19 +00:00
Mark Zhuang 114ad468ca server: convert 'unsigned' to 'unsigned int'
Conversion done with
        checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.

Change-Id: Ib0cbd9388d61659f8d47c8f57c09baa6df123487
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8369
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:03:04 +00:00
Mark Zhuang 134e56338d target: riscv: convert 'unsigned' to 'unsigned int'
Change-Id: I10b9abf9e42389eb91b210b8c2f01219ca9068cd
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8366
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:02:42 +00:00
Antonio Borneo 34ec5536c0 stlink: deprecate HLA support
The STLink API that supports dap-direct is available from STLink
firmware v2j24, published in early 2015.
We can reasonably expect that any old STLink still in use today
has got at least one firmware update during the last 10 years.

Most of the board files in upstream OpenOCD still use the STLink
in HLA mode. This limits the test coverage of the dap-direct code,
which was introduced in OpenOCD v0.11.0.

- Rename interface/stlink.cfg as interface/stlink-hla.cfg to still
  provide support for HLA, adding a deprecated message.

- Rename interface/stlink-dap.cfg as interface/stlink.cfg to make
  dap-direct the default trasport.

- Add a redirect file interface/stlink-dap.cfg for users that have
  out-of-tree custom board files.

- Update all the board files to the new setup.

- Remove STLink HLA mentions from the documentation, while adding
  a reference to interface/stlink-hla.cfg

Checkpatch-ignore: LONG_LINE
Change-Id: I99366bb03cd3b83f8f408514e657f30e59813063
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8523
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
2024-11-02 21:01:07 +00:00
Antonio Borneo 3ce0962f2c target: cortex_m: fix polling for target kept under reset
In multi-target SoC not all the targets are running simultaneously
and some target could be powered off or kept under reset.
Commit 4892e32294 ("target/cortex_m: allow poll quickly get out
of TARGET_RESET state") does not considers the case of a target
that is kept in reset and expects the target to change state from
TARGET_RESET immediately.
This causes OpenOCD to log continuously:
	Info : [stm32mp15x.cm4] external reset detected
	Info : [stm32mp15x.cm4] external reset detected
	Info : [stm32mp15x.cm4] external reset detected

Read again dhcsr to detect the 'stable' reset status and quit,
waiting for next poll to re-check the target's status.

Change-Id: Ic66029b988404a1599bb99bc66d4a8845b8b02c6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 4892e32294 ("target/cortex_m: allow poll quickly get out of TARGET_RESET state")
Reviewed-on: https://review.openocd.org/c/openocd/+/8399
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-11-02 20:59:48 +00:00
R. Diez 7214c8be46 configure: show adapter Xilinx XVC/PCIe in the configuration summary
Adapter Xilinx XVC/PCIe was not appearing in the configuration summary
because of the wrong variable name: build_xlnx_pcie_xvc
instead of enable_xlnx_pcie_xvc.

Also build this adapter automatically on Linux.

Change-Id: I69ea92f550052b9ce55ce32597ac446a15a87388
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8312
Tested-by: jenkins
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 20:59:15 +00:00
Jan Matyas d09ff47644 gdb_server: Improve const correctness
On several packet-handling functions, add "const" to arguments
that represent read-only packet buffers.

For instance on GCC 13.2.0, this code:

const char *some_packet = "...";
gdb_put_packet(conn, some_packet, strlen(some_packet));

would prior to the fix produce warning:

passing argument 2 of ‘gdb_put_packet’ discards ‘const’
qualifier from pointer target type [-Wdiscarded-qualifiers]

Change-Id: Idb62f57d37ed323c39de38982e57afdd3882e280
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8517
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-10-20 09:25:25 +00:00
Jan Matyas 114ca19f64 gitignore: Start ignoring ".vscode"
To help the developers who use Visual Studio Code IDE,
ignore the ".vscode" folder in Git. This folder contains
local configuration of the VSCode workspace.

Change-Id: I1d54d8ce2bd0680f2fa1fb773bb33c786bdcc608
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8518
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-10-20 09:24:43 +00:00
Florian Fainelli 21a211d547 arm_adi_v5: Added Cortex-A55 debug unit identifier
Add identifier of the Cortex-A55 debug unit.

Change-Id: I67336094a5153a3187cccc32c0e38d78ae4af542
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8430
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-20 09:24:15 +00:00
Antonio Borneo fec3b22421 target: riscv: remove non-trivial 'unsigned' cast
Change the prototype of riscv_batch_get_dmi_read_op().
Now that 'target->smp' is unsigned, drop the cast.

Change-Id: I2a54268ed1e4bf0ea884b62cceb73f5c7451da78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8484
Tested-by: jenkins
2024-10-20 09:23:09 +00:00
Antonio Borneo 957eb741a0 target: riscv: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Change-Id: I11f10eddadc21e051c96eb3d4d4c0554a2cddd15
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8483
Tested-by: jenkins
2024-10-20 09:22:52 +00:00
Antonio Borneo bcf63ac562 checkpatch: check SPDX in Makefile
The firmware in contrib folder use Makefile for the build.
Force checkpatch to check these Makefile for the SPDX.

Change-Id: I815bf6df636c96a15f82c3d8a9de0c4f219303d2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8520
Tested-by: jenkins
2024-10-20 09:21:11 +00:00
Jan Matyas edf2c82cf6 helper/align.h: Fix macro IS_PWR_OF_2
Zero is not a power of two.

All functions that use IS_PWR_OF_2 were checked and the edge case
of IS_PWR_OF_2(0) does not occur anywhere at the moment. Therefore
the fix is safe.

Change-Id: I84d9f9c64c9a7df452ca6e99c2ee4169ccb2b0be
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Fixes: 9544cd653d ("helper: add align.h")
Reviewed-on: https://review.openocd.org/c/openocd/+/8511
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-10-05 15:53:43 +00:00
Antonio Borneo 30c3d077f2 jimtcl: update to version 0.83
New version tagged on 2024-08-28.

Change-Id: Id0cf82a692469ccf794c9680c5d5ac09ea26e6da
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8513
Tested-by: jenkins
2024-10-05 15:53:02 +00:00
Antonio Borneo 73390332d2 openocd: fix build with jimtcl 0.83
In jimtcl 0.82, the include file jim.h included in turn stdio.h
This made redundant to include the former in openocd source files.
Since jimtcl 0.83, jim.h drops the include of stdio.h, causing
openocd build to fail.

Include stdio.h in the files that need it.

Change-Id: Ic81c9b273d7520f4d2d8c32bc3e0a6bcfffb67ed
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8512
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
2024-10-05 15:52:26 +00:00
Antonio Borneo 116e9553d1 openocd: build: allow more socket connections on Windows
Cross compiling OpenOCD for Windows forces the maximum number of
open files (including sockets) to 64. See in include file
psdk_inc/_fd_types.h:
	#ifndef FD_SETSIZE
	#define FD_SETSIZE 64
	#endif

This limit is far lower than the default value 1024 used by Linux.

In pull request #644 [1] in risc-v fork it's reported that:
- each socket server of OpenOCD (GDB, telnet, ...) uses one FD;
- each active connection to a socket server uses another FD;
- multi-core devices with 32 or more cores, each having a GDB
  connection, already saturates the 64 available FD at the 26th
  GDB connection.

The patch [2] proposed and merged in risc-v fork adds the compile
flag
	-DFD_SETSIZE=128
to all the host types. While this looks fine for Windows, it
reduces the default value for Linux and other OS.

Add the compile flag FD_SETSIZE only to cross compile for Windows.

Link: [1] https://github.com/riscv-collab/riscv-openocd/pull/644
Link: [2] https://github.com/riscv-collab/riscv-openocd/pull/644/commits/1bab4cfbc4f4
Change-Id: Ie43a792ac11a5e63e0407b68e3f270efea0c87be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8503
Tested-by: jenkins
2024-10-05 15:51:58 +00:00
Antonio Borneo 595bb965b7 jtag: bcm2835gpio: fix macro definition
The macros trigger few errors with checkpatch:

	ERROR:MACRO_ARG_REUSE: Macro argument reuse 'g' - possible
	side-effects?

	ERROR:TRAILING_STATEMENTS: trailing statements should be
	on next line

	ERROR:SPACING: spaces preferred around (several cases)

	ERROR:SINGLE_STATEMENT_DO_WHILE_MACRO: Single statement
	macros should not use a do {} while (0) loop

plus an empty line triggers

	ERROR:BRACES: Blank lines aren't necessary before a close
	brace '}'

Fix them!

Change-Id: I0690b68b511ed7f45a7e0909a0addd2822ba9fe8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8499
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-10-05 15:50:23 +00:00
Antonio Borneo 8c23e6c175 target: arm: drop casts commented-out
The function dpm->finish() returns a value that is almost always
ignored.
Drop the commented-out cast
	/* (void) */

Change-Id: I7ff210a2693dd1877b7c7591705cdcd96a2c6125
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8498
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:49:49 +00:00
Antonio Borneo 3ccf68cd0a OpenOCD: drop comparison with true/false
Fix checkpatch errors:

	ERROR:BOOL_COMPARISON: Using comparison to true/false is
	error prone

While there,
- drop useless parenthesis,
- drop unnecessary else after a return.

Change-Id: I1234737b3e65bd10df5e938d1c36f9abaf02d348
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8496
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:49:04 +00:00
Antonio Borneo 66006d83b9 target: drop comparison to NULL
Fix checkpatch error:

	ERROR:COMPARISON_TO_NULL: Comparison to NULL could be
	written "cmd_ctx"

Change-Id: I3615fc427f8b160d44b6edbf7a066a086cab99bb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8495
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:48:48 +00:00
Antonio Borneo 39197cdb4e jtag: stlink_usb: drop comparison to NULL
Fix checkpatch error:

	ERROR:COMPARISON_TO_NULL: Comparison to NULL could be
	written "handle"

Change-Id: I0ac12ccfc5fce4dd41266f83eb4b973a4e6a314d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8494
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:48:35 +00:00
Antonio Borneo 4214fca447 OpenOCD: fix code alignment
Fix checkpatch errors:

	ERROR:TABSTOP: Statements should start on a tabstop

Change-Id: Ia771e7b7fa2cc4ef0be7f52b670525175555c8e4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8493
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:48:23 +00:00
Antonio Borneo 537793bb24 target: mem_ap: drop return from void function
Checkpatch triggers the error

	ERROR:RETURN_VOID: void function return statements are not
	generally useful

Fix it!

Change-Id: I72d9fb8242d6a91c0aa481d5d023f0359c76a5ec
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8492
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:48:11 +00:00