Compare commits

...

17 Commits

Author SHA1 Message Date
Adrien Grassein
72ff2e2d9f target/armv8: regularly send keep_alive packet.
Flushing all d-cache may be a long operation.
We need to send keep_alive regularly to keep the connection alive.
If not done a warning is emitted.

Change-Id: I52c3ee9a9f9b8a1dc0b8d5439e8b71212f56165a
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8659
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-03-15 10:34:45 +00:00
Adrien Grassein
bb4c7e3233 tcl/ngultra: Use newly created armv8r target
ngultra cores are cortex-r52, so use armv8r target now its created.

Change-Id: If2d22593ab1e200ac15e7b883c70937acf1d2a59
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8658
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-03-15 10:34:06 +00:00
Antonio Borneo
4275280698 adapter: simplify command 'adapter list'
The code of command 'adapter list' is called by command 'adapter
driver' to list the available drivers in case of error.
This dual possible entry points require a conditional check on the
number of command line arguments, reducing the code readability.

Split the command in a simpler code for the command 'adapter list'
that only checks the command line, and move in a common helper the
code that list the drivers.

While there, fix the output and the comments to report 'adapter
driver' instead of 'debug adapters'; we are not parsing the HW to
know which adapter is present.

Change-Id: I17538e86dc4a31a9589d404e49dcc65a29393390
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8672
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-03-15 10:20:47 +00:00
Antonio Borneo
6beb6280af adapter: drop command 'adapter transports'
The commit 93f2afa45f ("initial "transport" framework") that
added the transport framework in 2010 was overly optimistic on the
possibility to dynamically add, at runtime, a new adapter and to
specify with the command 'adapter transports' the list of the
transports supported by the new adapter.

Such feature has never become part of OpenOCD, and the command
above has never become useful nor ever been used.

Drop the command 'adapter transports' and its documentation.
Drop the helper 'transport_list_parse', now unused.

Change-Id: Ie3d71c74d068fba802839b116bb9bc9af77cc83d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8671
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-03-15 10:20:32 +00:00
Antonio Borneo
e4a51b3235 doc: drop mention of not implemented SPI transport
The commit 93f2afa45f ("initial "transport" framework") adds a
dedicated chapter in the documentation about a possible SPI
transport for flashing.
This transport has never been part of OpenOCD and should not be
listed in the documentation.

Drop the chapter.

Change-Id: I9b406754399abda4dc7c2f8cf09dd47730a7e1d9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8670
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-03-15 10:20:12 +00:00
Evgeniy Naydanov
e12ceddd5e helper/log: mark fmt argument of alloc_vprintf() as format string
Building on Ubuntu 22.04 with `-fsanitize=undefined` (GCC 12.3.0)
results in an error:
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
```
In file included from /usr/include/stdio.h:894,
                 from <openocd>/src/helper/system.h:23,
                 from <openocd>/src/helper/replacements.h:18,
                 from <openocd>/src/helper/log.c:20:
In function ‘vsnprintf’,
    inlined from ‘alloc_vprintf’ at <openocd>/src/helper/log.c:347:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:85:10: error: null format string [-Werror=format-truncation=]
   85 |   return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   86 |                                     __glibc_objsize (__s), __fmt, __ap);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```

The error mentiones the call site `src/helper/log.c:347`. There
`vsnprintf()` is called passing `fmt` as format string.

To mitigate this, mark the format string with the corresponding
attribute in `alloc_vprintf()`

Change-Id: I91011490715998ef5a931c19c3c9d74a1a304e5d
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8764
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-03-15 10:19:45 +00:00
R. Diez
a2d4b9b718 bcm2835gpio.c: change adapter init order
Make also sure that the struct bitbang_interface with callbacks
that we pass to the bitbang driver is const.

Change-Id: I954014f062d6d9185db45f5fbd2ad0b0955aab82
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8536
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:19:11 +00:00
R. Diez
fdd0c2b1d3 configure.ac: show the JTAG DPI and VPI adapters in the config summary
Also enable these adapters by default (auto).

Change-Id: Icbbcd470eaf1d1bfb33900885776c1dbd0cccb5f
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8758
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:18:41 +00:00
Evgeniy Naydanov
16c6497a89 rtos/linux: fix name overwrite in linux_thread_extra_info()
commit 908ee4dc96 ("build: remove clang
unused variable assignment warnings") introduced an error:
```
-            tmp_str_ptr += sprintf(tmp_str_ptr, "%s", name);
+            sprintf(tmp_str_ptr, "%s", name);
             sprintf(tmp_str_ptr, "%s", temp->name);
```
This results in `name` being overwritten by `temp->name`.
Fix this, adding OOM handling along the way.

Change-Id: Id41f73247c3f7e6194d7c92187ad3163a9ea6c89
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8761
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:18:11 +00:00
Marc Schink
d892a4d763 target/arm_adiv5: print DAP name if not found
If a DAP is not found, include its name in the error message.

Change-Id: Icffc52894a1c5573f938b1f3e3b53441167f085e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8636
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:17:15 +00:00
Shivasharan Nagalikar
80b1c9aff8 tcl/board: Add TI AM261 launchpad config
Add basic connection details with AM261 Launchpad.

For further details, see https://www.ti.com/tool/LP-AM261

Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Change-Id: Ibf1270a8e470cc6ab5846dc3da64e451a8a769fd
Reviewed-on: https://review.openocd.org/c/openocd/+/8793
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Nishanth Menon <nm@ti.com>
2025-03-15 10:16:03 +00:00
Shivasharan Nagalikar
da7e369266 tcl/target/ti_k3: Add support for AM261
AM261[1] is a optimized cutdown of AM263P SoC. The key difference is
the reduced number of R5F cores which is now dropped down to 2, and
the DIE ID is different from AM263p, but all other definitions are
compatible, so reuse the definition.

[1] https://www.ti.com/product/AM2612

Change-Id: Ib6ca0b59d0b8991df6e4ab349d371187438cb393
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8792
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
2025-03-15 10:15:46 +00:00
Shivasharan Nagalikar
c00228468c tcl/board: Add TI AM263P launchpad config
Add basic connection details with AM263P Launchpad

For further details, see: https://www.ti.com/tool/LP-AM263P

Change-Id: I7232a0b9337583eab499bc72929bd059624b4ff1
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8771
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
2025-03-15 10:15:28 +00:00
Shivasharan Nagalikar
9e5ffed7d6 tcl/target/ti_k3: Add support for AM263P
AM263P[1] adds additional features to AM263 SoC. [2] provides a
detailed list of differences, however, the key difference from
processor usage perspective is the increased SRAM and Remote L2(RL2)
Cache for improved performance of R5F. To differentiate the DIE ID
is different, however rest of the processor description remain
compatible to AM263, hence reuse the definition.

[1] https://www.ti.com/product/AM263P4
[2] https://www.ti.com/lit/pdf/spradb3

Change-Id: If47935caf1f995d7e606547e0d6545c39544678a
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8770
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:15:16 +00:00
Shivasharan Nagalikar
a2c3c791ad tcl/target/ti_k3: Add support for system reset using powerAP
TI K3 Debug systems have a Power Access Port (Power-AP) which allows
for functionality such as reset via debugger that using the SPREC
register. SoCs/Boards that do not have support for SRST or TRST can
make use of this to force a system reset via debug access.

Change-Id: Ic5f9cc7f7fba77b353b0c0b42d8afc02502251a0
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8769
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:14:58 +00:00
Nishanth Menon
a8555b0b6d tcl/board: Add TI am62levm config
Add basic connection details with AM62l SK/EVM

For further details, see: https://www.ti.com/tool/TMDS62LEVM

Change-Id: Ic957a904dfe01951396f9767479884f2a121b181
Co-developed-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8799
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:14:25 +00:00
Nishanth Menon
5300242a3e tcl/target/ti_k3: Add AM62L SoC
Add support for the TI K3 family AM62L SoC.

For further details, see https://www.ti.com/lit/pdf/sprujb4

Change-Id: I31e4e89507a1cd70a8c8c3242dd0a9dd7d0f2a06
Co-developed-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8798
Tested-by: jenkins
Reviewed-by: Bryan Brattlof <bryanbrattlof@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-15 10:14:10 +00:00
15 changed files with 172 additions and 144 deletions

View File

@@ -178,6 +178,12 @@ m4_define([LINUXSPIDEV_ADAPTER],
m4_define([VDEBUG_ADAPTER],
[[[vdebug], [Cadence Virtual Debug Interface], [VDEBUG]]])
m4_define([JTAG_DPI_ADAPTER],
[[[jtag_dpi], [JTAG DPI Adapter], [JTAG_DPI]]])
m4_define([JTAG_VPI_ADAPTER],
[[[jtag_vpi], [JTAG VPI Adapter], [JTAG_VPI]]])
# The word 'Adapter' in "Dummy Adapter" below must begin with a capital letter
# because there is an M4 macro called 'adapter'.
m4_define([DUMMY_ADAPTER],
@@ -308,6 +314,8 @@ AC_ARG_ADAPTERS([
SERIAL_PORT_ADAPTERS,
DUMMY_ADAPTER,
VDEBUG_ADAPTER,
JTAG_DPI_ADAPTER,
JTAG_VPI_ADAPTER,
PCIE_ADAPTERS,
LIBJAYLINK_ADAPTERS
],[auto])
@@ -326,14 +334,6 @@ AC_ARG_ENABLE([parport_giveio],
[Enable use of giveio for parport (for CygWin only)]),
[parport_use_giveio=$enableval], [parport_use_giveio=])
AC_ARG_ENABLE([jtag_vpi],
AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
[build_jtag_vpi=$enableval], [build_jtag_vpi=no])
AC_ARG_ENABLE([jtag_dpi],
AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
[build_jtag_dpi=$enableval], [build_jtag_dpi=no])
AC_ARG_ENABLE([amtjtagaccel],
AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
[build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
@@ -577,19 +577,6 @@ AS_IF([test "x$parport_use_giveio" = "xyes"], [
AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
])
AS_IF([test "x$build_jtag_vpi" = "xyes"], [
AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.])
], [
AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
])
AS_IF([test "x$build_jtag_dpi" = "xyes"], [
AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
], [
AC_DEFINE([BUILD_JTAG_DPI], [0], [0 if you don't want JTAG DPI.])
])
AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
], [
@@ -735,6 +722,8 @@ PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], ["x$can_build_buspirate" = "xyes"],
[internal error: validation should happen beforehand])
PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], ["x$is_linux" = "xyes"], [Linux spidev])
PROCESS_ADAPTERS([VDEBUG_ADAPTER], [true], [unused])
PROCESS_ADAPTERS([JTAG_DPI_ADAPTER], [true], [unused])
PROCESS_ADAPTERS([JTAG_VPI_ADAPTER], [true], [unused])
PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])
AS_IF([test "x$enable_linuxgpiod" != "xno"], [
@@ -782,8 +771,6 @@ AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"])
AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"])
AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"])
AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
@@ -889,6 +876,8 @@ m4_foreach([adapter], [USB1_ADAPTERS,
LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
LINUXSPIDEV_ADAPTER,
VDEBUG_ADAPTER,
JTAG_DPI_ADAPTER,
JTAG_VPI_ADAPTER,
DUMMY_ADAPTER,
OPTIONAL_LIBRARIES,
COVERAGE],

View File

@@ -2415,12 +2415,6 @@ target.
List the debug adapter drivers that have been built into
the running copy of OpenOCD.
@end deffn
@deffn {Config Command} {adapter transports} transport_name+
Specifies the transports supported by this debug adapter.
The adapter driver builds-in similar knowledge; use this only
when external configuration (such as jumpering) changes what
the hardware can support.
@end deffn
@anchor{adapter gpio}
@deffn {Config Command} {adapter gpio [ @
@@ -3816,13 +3810,6 @@ Not all adapters and adapter drivers support SWD multi-drop. Only the following
adapter drivers are SWD multi-drop capable:
cmsis_dap (use an adapter with CMSIS-DAP version 2.0), ftdi, all bitbang based.
@subsection SPI Transport
@cindex SPI
@cindex Serial Peripheral Interface
The Serial Peripheral Interface (SPI) is a general purpose transport
which uses four wire signaling. Some processors use it as part of a
solution for flash programming.
@anchor{swimtransport}
@subsection SWIM Transport
@cindex SWIM

View File

@@ -85,7 +85,8 @@ struct log_callback {
int log_add_callback(log_callback_fn fn, void *priv);
int log_remove_callback(log_callback_fn fn, void *priv);
char *alloc_vprintf(const char *fmt, va_list ap);
char *alloc_vprintf(const char *fmt, va_list ap)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 1, 0)));
char *alloc_printf(const char *fmt, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 1, 2)));

View File

@@ -392,31 +392,8 @@ COMMAND_HANDLER(handle_adapter_name)
return ERROR_OK;
}
COMMAND_HANDLER(adapter_transports_command)
COMMAND_HANDLER(dump_adapter_driver_list)
{
char **transports;
int retval;
retval = CALL_COMMAND_HANDLER(transport_list_parse, &transports);
if (retval != ERROR_OK)
return retval;
retval = allow_transports(CMD_CTX, (const char **)transports);
if (retval != ERROR_OK) {
for (unsigned int i = 0; transports[i]; i++)
free(transports[i]);
free(transports);
}
return retval;
}
COMMAND_HANDLER(handle_adapter_list_command)
{
if (strcmp(CMD_NAME, "list") == 0 && CMD_ARGC > 0)
return ERROR_COMMAND_SYNTAX_ERROR;
command_print(CMD, "The following debug adapters are available:");
for (unsigned int i = 0; adapter_drivers[i]; i++) {
const char *name = adapter_drivers[i]->name;
command_print(CMD, "%u: %s", i + 1, name);
@@ -425,6 +402,14 @@ COMMAND_HANDLER(handle_adapter_list_command)
return ERROR_OK;
}
COMMAND_HANDLER(handle_adapter_list_command)
{
if (CMD_ARGC)
return ERROR_COMMAND_SYNTAX_ERROR;
return CALL_COMMAND_HANDLER(dump_adapter_driver_list);
}
COMMAND_HANDLER(handle_adapter_driver_command)
{
int retval;
@@ -459,7 +444,8 @@ COMMAND_HANDLER(handle_adapter_driver_command)
*/
LOG_ERROR("The specified debug interface was not found (%s)",
CMD_ARGV[0]);
CALL_COMMAND_HANDLER(handle_adapter_list_command);
command_print(CMD, "The following adapter drivers are available:");
CALL_COMMAND_HANDLER(dump_adapter_driver_list);
return ERROR_JTAG_INVALID_INTERFACE;
}
@@ -1137,13 +1123,6 @@ static const struct command_registration adapter_command_handlers[] = {
.usage = "",
.chain = adapter_srst_command_handlers,
},
{
.name = "transports",
.handler = adapter_transports_command,
.mode = COMMAND_CONFIG,
.help = "Declare transports the adapter supports.",
.usage = "transport ...",
},
{
.name = "usb",
.mode = COMMAND_ANY,

View File

@@ -427,7 +427,7 @@ static int bcm2835gpio_blink(bool on)
return ERROR_OK;
}
static struct bitbang_interface bcm2835gpio_bitbang = {
static const struct bitbang_interface bcm2835gpio_bitbang_swd_write_generic = {
.read = bcm2835gpio_read,
.write = bcm2835gpio_write,
.swdio_read = bcm2835_swdio_read,
@@ -436,11 +436,19 @@ static struct bitbang_interface bcm2835gpio_bitbang = {
.blink = bcm2835gpio_blink,
};
static const struct bitbang_interface bcm2835gpio_bitbang_swd_write_fast = {
.read = bcm2835gpio_read,
.write = bcm2835gpio_write,
.swdio_read = bcm2835_swdio_read,
.swdio_drive = bcm2835_swdio_drive,
.swd_write = bcm2835gpio_swd_write_fast,
.blink = bcm2835gpio_blink,
};
static int bcm2835gpio_init(void)
{
LOG_INFO("BCM2835 GPIO JTAG/SWD bitbang driver");
bitbang_interface = &bcm2835gpio_bitbang;
adapter_gpio_config = adapter_gpio_get_config();
if (transport_is_jtag() && !bcm2835gpio_jtag_mode_possible()) {
@@ -509,6 +517,8 @@ LOG_INFO("pads conf set to %08x", pads_base[BCM2835_PADS_GPIO_0_27_OFFSET]);
initialize_gpio(ADAPTER_GPIO_IDX_TRST);
}
const struct bitbang_interface *bcm2835gpio_bitbang = &bcm2835gpio_bitbang_swd_write_generic;
if (transport_is_swd()) {
/* swdio and its buffer should be initialized in the order that prevents
* two outputs from being connected together. This will occur if the
@@ -529,16 +539,18 @@ LOG_INFO("pads conf set to %08x", pads_base[BCM2835_PADS_GPIO_0_27_OFFSET]);
if (adapter_gpio_config[ADAPTER_GPIO_IDX_SWCLK].drive == ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL &&
adapter_gpio_config[ADAPTER_GPIO_IDX_SWDIO].drive == ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL) {
LOG_DEBUG("BCM2835 GPIO using fast mode for SWD write");
bcm2835gpio_bitbang.swd_write = bcm2835gpio_swd_write_fast;
bcm2835gpio_bitbang = &bcm2835gpio_bitbang_swd_write_fast;
} else {
LOG_DEBUG("BCM2835 GPIO using generic mode for SWD write");
bcm2835gpio_bitbang.swd_write = bcm2835gpio_swd_write_generic;
assert(bcm2835gpio_bitbang == &bcm2835gpio_bitbang_swd_write_generic);
}
}
initialize_gpio(ADAPTER_GPIO_IDX_SRST);
initialize_gpio(ADAPTER_GPIO_IDX_LED);
bitbang_interface = bcm2835gpio_bitbang;
return ERROR_OK;
}

View File

@@ -1120,23 +1120,13 @@ static int linux_thread_extra_info(struct target *target,
while (temp) {
if (temp->threadid == threadid) {
char *pid = " PID: ";
char *pid_current = "*PID: ";
char *name = "Name: ";
int str_size = strlen(pid) + strlen(name);
char *tmp_str = calloc(1, str_size + 50);
char *tmp_str_ptr = tmp_str;
/* discriminate current task */
if (temp->status == 3)
tmp_str_ptr += sprintf(tmp_str_ptr, "%s",
pid_current);
else
tmp_str_ptr += sprintf(tmp_str_ptr, "%s", pid);
tmp_str_ptr += sprintf(tmp_str_ptr, "%d, ", (int)temp->pid);
sprintf(tmp_str_ptr, "%s", name);
sprintf(tmp_str_ptr, "%s", temp->name);
char *tmp_str = alloc_printf("%cPID: %" PRIu32 ", Name: %s",
temp->status == 3 ? '*' : ' ',
temp->pid, temp->name);
if (!tmp_str) {
LOG_ERROR("Out of memory");
return ERROR_FAIL;
}
char *hex_str = calloc(1, strlen(tmp_str) * 2 + 1);
size_t pkt_len = hexify(hex_str, (const uint8_t *)tmp_str,
strlen(tmp_str), strlen(tmp_str) * 2 + 1);

View File

@@ -2367,7 +2367,9 @@ static int adiv5_jim_spot_configure(struct jim_getopt_info *goi,
return e;
dap = dap_instance_by_jim_obj(goi->interp, o_t);
if (!dap) {
Jim_SetResultString(goi->interp, "DAP name invalid!", -1);
const char *dap_name = Jim_GetString(o_t, NULL);
Jim_SetResultFormatted(goi->interp, "DAP '%s' not found",
dap_name);
return JIM_ERR;
}
if (*dap_p && *dap_p != dap) {

View File

@@ -61,6 +61,7 @@ static int armv8_cache_d_inner_flush_level(struct armv8_common *armv8, struct ar
goto done;
c_way -= 1;
} while (c_way >= 0);
keep_alive();
c_index -= 1;
} while (c_index >= 0);

View File

@@ -166,54 +166,6 @@ struct transport *get_current_transport(void)
* Infrastructure for Tcl interface to transports.
*/
/**
* Makes and stores a copy of a set of transports passed as
* parameters to a command.
*
* @param vector where the resulting copy is stored, as an argv-style
* NULL-terminated vector.
*/
COMMAND_HELPER(transport_list_parse, char ***vector)
{
char **argv;
unsigned int n = CMD_ARGC;
unsigned int j = 0;
*vector = NULL;
if (n < 1)
return ERROR_COMMAND_SYNTAX_ERROR;
/* our return vector must be NULL terminated */
argv = calloc(n + 1, sizeof(char *));
if (!argv)
return ERROR_FAIL;
for (unsigned int i = 0; i < n; i++) {
struct transport *t;
for (t = transport_list; t; t = t->next) {
if (strcmp(t->name, CMD_ARGV[i]) != 0)
continue;
argv[j++] = strdup(CMD_ARGV[i]);
break;
}
if (!t) {
LOG_ERROR("no such transport '%s'", CMD_ARGV[i]);
goto fail;
}
}
*vector = argv;
return ERROR_OK;
fail:
for (unsigned int i = 0; i < n; i++)
free(argv[i]);
free(argv);
return ERROR_FAIL;
}
COMMAND_HANDLER(handle_transport_init)
{
LOG_DEBUG("%s", __func__);

View File

@@ -77,8 +77,6 @@ struct transport *get_current_transport(void);
int transport_register_commands(struct command_context *ctx);
COMMAND_HELPER(transport_list_parse, char ***vector);
int allow_transports(struct command_context *ctx, const char * const *vector);
bool transport_is_jtag(void);

View File

@@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
#
# Texas Instruments AM261 Launchpad
# https://www.ti.com/tool/LP-AM261
#
# AM263 Launchpad has an xds110 onboard.
source [find interface/xds110.cfg]
transport select jtag
# default JTAG configuration has only SRST and no TRST
reset_config srst_only srst_push_pull
# delay after SRST goes inactive
adapter srst delay 20
if { ![info exists SOC] } {
set SOC am261
}
source [find target/ti_k3.cfg]
adapter speed 250

View File

@@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
#
# Texas Instruments AM263P Launchpad
# https://www.ti.com/tool/LP-AM263P
#
# AM263P Launchpad has an xds110 onboard.
source [find interface/xds110.cfg]
transport select jtag
# default JTAG configuration has only SRST and no TRST
reset_config srst_only srst_push_pull
# delay after SRST goes inactive
adapter srst delay 20
if { ![info exists SOC] } {
set SOC am263p
}
source [find target/ti_k3.cfg]
adapter speed 250

25
tcl/board/ti_am62levm.cfg Normal file
View File

@@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
#
# Texas Instruments AM62L EVM:
# Links: https://www.ti.com/tool/TMDS62LEVM
#
# the AM62L3 EVM/SK has an xds110 onboard.
source [find interface/xds110.cfg]
transport select jtag
# default JTAG configuration has only SRST and no TRST
reset_config srst_only srst_push_pull
# delay after SRST goes inactive
adapter srst delay 20
if { ![info exists SOC] } {
set SOC am62l
}
source [find target/ti_k3.cfg]
adapter speed 2500

View File

@@ -36,12 +36,11 @@ dap create $_CHIPNAME.coresight.dap -chain-position $_CHIPNAME.coresight.cpu
for { set _core 0 } { $_core < $_cores } { incr _core } {
cti create cti.$_core -dap $_CHIPNAME.coresight.dap -ap-num 0 \
-baseaddr [lindex $CTIBASE $_core]
# Cores are armv8-r but works with aarch64 (since armv8-r not directly supported by openocd yet).
if { $_core == 0} {
target create core.$_core aarch64 -dap $_CHIPNAME.coresight.dap \
target create core.$_core armv8r -dap $_CHIPNAME.coresight.dap \
-ap-num 0 -dbgbase [lindex $DBGBASE $_core] -cti cti.$_core
} else {
target create core.$_core aarch64 -dap $_CHIPNAME.coresight.dap \
target create core.$_core armv8r -dap $_CHIPNAME.coresight.dap \
-ap-num 0 -dbgbase [lindex $DBGBASE $_core] -cti cti.$_core -defer-examine
}
}

View File

@@ -4,8 +4,12 @@
# Texas Instruments K3 devices:
# * AM243: https://www.ti.com/lit/pdf/spruim2
# Has 4 R5 Cores, M4F and an M3
# * AM261: https://www.ti.com/lit/pdf/sprujb6
# Has 2 R5 Cores and an M4F
# * AM263: https://www.ti.com/lit/pdf/spruj17
# Has 4 R5 Cores and an M3
# * AM263P: https://www.ti.com/lit/pdf/spruj55
# Has 4 R5 Cores and an M4F
# * AM273: https://www.ti.com/lit/pdf/spruiu0
# Has 2 R5 Cores and an M3
# * AM625: https://www.ti.com/lit/pdf/spruiv7a
@@ -14,6 +18,8 @@
# Has 4 ARMV8 Cores and 2 R5 Cores
# * AM62P: https://www.ti.com/lit/pdf/spruj83
# Has 4 ARMV8 Cores and 2 R5 Cores
# * AM62L: https://www.ti.com/lit/pdf/sprujb4
# Has 2 ARMv8 Cores only
# * AM642: https://www.ti.com/lit/pdf/spruim2
# Has 2 ARMV8 Cores and 4 R5 Cores, M4F and an M3
# * AM654x: https://www.ti.com/lit/pdf/spruid7
@@ -77,8 +83,16 @@ set _gp_mcu_ap_unlock_offsets {0xf0 0x60}
# Generic mem-ap port number
set _mem_ap_num 2
# Generic AP_SEL PWR Register number
set _power_ap_num 3
# Generic SPREC RESET BANK and Field number
set _powerap_sprec_reset 0xf0
# Set configuration overrides for each SOC
switch $_soc {
am261 -
am263p -
am263 {
set _K3_DAP_TAPID 0x2bb7d02f
@@ -94,6 +108,16 @@ switch $_soc {
set R5_DBGBASE {0x90030000 0x90032000 0x90050000 0x90052000}
set R5_CTIBASE {0x90038000 0x90039000 0x90058000 0x90059000}
set _r5_ap_num 5
set _power_ap_num 7
if { "$_soc" == "am263p" } {
set _K3_DAP_TAPID 0x1bb9502f
}
if { "$_soc" == "am261" } {
set _K3_DAP_TAPID 0x1bba602f
set _r5_cores 2
}
}
am273 {
set _K3_DAP_TAPID 0x1bb6a02f
@@ -233,6 +257,18 @@ switch $_soc {
set R5_CTIBASE {0x9d418000 0x9d518000 0x9d818000}
}
}
am62l {
set _K3_DAP_TAPID 0x0bba702f
# AM62Lx has 1 cluster of 2 A53 cores.
set _armv8_cpu_name a53
set _armv8_cores 2
set ARMV8_DBGBASE {0x90010000 0x90110000}
set ARMV8_CTIBASE {0x90020000 0x90120000}
# Has no supporting microcontrollers
set _r5_cores 0
}
j721e {
set _K3_DAP_TAPID 0x0bb6402f
# J721E has 1 cluster of 2 A72 cores.
@@ -499,3 +535,10 @@ if { 0 == [string compare [adapter name] dmem ] } {
# AXI AP access port for SoC address map
target create $_CHIPNAME.axi_ap mem_ap -dap $_CHIPNAME.dap -ap-num $_mem_ap_num
}
# Reset system using (Debug Reset) SPREC Register,SYSTEMRESET bit field via apreg
proc dbg_sys_reset {} {
$::_CHIPNAME.dap apreg $::_power_ap_num $::_powerap_sprec_reset 0x1
}
add_help_text dbg_sys_reset "Debugger initiated system reset attempt via Power-AP"