mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-14 02:58:23 +08:00
Compare commits
6 Commits
169d463a3d
...
6834f022b9
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6834f022b9 | ||
![]() |
e45d66fd9a | ||
![]() |
9eb2426411 | ||
![]() |
160f7b3e5d | ||
![]() |
c023534e7b | ||
![]() |
04124c77f4 |
51
configure.ac
51
configure.ac
@@ -164,6 +164,9 @@ m4_define([LIBFTDI_USB1_ADAPTERS],
|
||||
m4_define([LIBGPIOD_ADAPTERS],
|
||||
[[[linuxgpiod], [Linux GPIO bitbang through libgpiod], [LINUXGPIOD]]])
|
||||
|
||||
m4_define([REMOTE_BITBANG_ADAPTER],
|
||||
[[[remote_bitbang], [Remote Bitbang driver], [REMOTE_BITBANG]]])
|
||||
|
||||
m4_define([LIBJAYLINK_ADAPTERS],
|
||||
[[[jlink], [SEGGER J-Link Programmer], [JLINK]]])
|
||||
|
||||
@@ -184,6 +187,9 @@ m4_define([JTAG_DPI_ADAPTER],
|
||||
m4_define([JTAG_VPI_ADAPTER],
|
||||
[[[jtag_vpi], [JTAG VPI Adapter], [JTAG_VPI]]])
|
||||
|
||||
m4_define([RSHIM_ADAPTER],
|
||||
[[[rshim], [BlueField SoC via rshim], [RSHIM]]])
|
||||
|
||||
# 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],
|
||||
@@ -282,10 +288,6 @@ AS_IF([test "x$debug_malloc" = "xyes" -a "x$have_glibc" = "xyes"], [
|
||||
AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE([rshim],
|
||||
AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]),
|
||||
[build_rshim=$enableval], [build_rshim=no])
|
||||
|
||||
AC_ARG_ENABLE([dmem],
|
||||
AS_HELP_STRING([--enable-dmem], [Enable building the dmem driver]),
|
||||
[build_dmem=$enableval], [build_dmem=no])
|
||||
@@ -310,12 +312,14 @@ AC_ARG_ADAPTERS([
|
||||
LIBFTDI_ADAPTERS,
|
||||
LIBFTDI_USB1_ADAPTERS,
|
||||
LIBGPIOD_ADAPTERS,
|
||||
REMOTE_BITBANG_ADAPTER,
|
||||
LINUXSPIDEV_ADAPTER,
|
||||
SERIAL_PORT_ADAPTERS,
|
||||
DUMMY_ADAPTER,
|
||||
VDEBUG_ADAPTER,
|
||||
JTAG_DPI_ADAPTER,
|
||||
JTAG_VPI_ADAPTER,
|
||||
RSHIM_ADAPTER,
|
||||
PCIE_ADAPTERS,
|
||||
LIBJAYLINK_ADAPTERS
|
||||
],[auto])
|
||||
@@ -379,19 +383,24 @@ AC_ARG_ENABLE([sysfsgpio],
|
||||
AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
|
||||
[build_sysfsgpio=$enableval], [build_sysfsgpio=no])
|
||||
|
||||
can_build_rshim=no
|
||||
|
||||
AS_CASE([$host_os],
|
||||
[linux*], [
|
||||
is_linux=yes
|
||||
can_build_rshim=yes
|
||||
],
|
||||
[
|
||||
AS_IF([test "x$build_sysfsgpio" = "xyes"], [
|
||||
AC_MSG_ERROR([sysfsgpio is only available on linux])
|
||||
])
|
||||
|
||||
AS_CASE([$host_os], [freebsd*], [],
|
||||
AS_CASE([$host_os], [freebsd*], [
|
||||
can_build_rshim=yes
|
||||
],
|
||||
[
|
||||
AS_IF([test "x$build_rshim" = "xyes"], [
|
||||
AC_MSG_ERROR([build_rshim is only available on linux or freebsd])
|
||||
AS_IF([test "x$enable_rshim" = "xyes"], [
|
||||
AC_MSG_ERROR([rshim is only available on linux or freebsd])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -413,10 +422,6 @@ AC_ARG_ENABLE([internal-libjaylink],
|
||||
[Enable building internal libjaylink]),
|
||||
[use_internal_libjaylink=$enableval], [use_internal_libjaylink=no])
|
||||
|
||||
AC_ARG_ENABLE([remote-bitbang],
|
||||
AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang driver]),
|
||||
[build_remote_bitbang=$enableval], [build_remote_bitbang=no])
|
||||
|
||||
AS_CASE(["${host_cpu}"],
|
||||
[i?86|x86*], [],
|
||||
[
|
||||
@@ -514,12 +519,6 @@ AS_IF([test "x$build_parport" = "xyes"], [
|
||||
AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.])
|
||||
])
|
||||
|
||||
AS_IF([test "x$build_rshim" = "xyes"], [
|
||||
AC_DEFINE([BUILD_RSHIM], [1], [1 if you want to debug BlueField SoC via rshim.])
|
||||
], [
|
||||
AC_DEFINE([BUILD_RSHIM], [0], [0 if you don't want to debug BlueField SoC via rshim.])
|
||||
])
|
||||
|
||||
AS_IF([test "x$build_dmem" = "xyes"], [
|
||||
AC_DEFINE([BUILD_DMEM], [1], [1 if you want to debug via Direct Mem.])
|
||||
], [
|
||||
@@ -611,13 +610,6 @@ AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test "x$build_remote_bitbang" = "xyes"], [
|
||||
build_bitbang=yes
|
||||
AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang driver.])
|
||||
], [
|
||||
AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang driver.])
|
||||
])
|
||||
|
||||
AS_IF([test "x$build_sysfsgpio" = "xyes"], [
|
||||
build_bitbang=yes
|
||||
AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
|
||||
@@ -716,6 +708,7 @@ PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libu
|
||||
PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
|
||||
PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
|
||||
PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [Linux libgpiod])
|
||||
PROCESS_ADAPTERS([REMOTE_BITBANG_ADAPTER], [true], [unused])
|
||||
PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
|
||||
PROCESS_ADAPTERS([PCIE_ADAPTERS], ["x$is_linux" = "xyes"], [Linux build])
|
||||
PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], ["x$can_build_buspirate" = "xyes"],
|
||||
@@ -724,12 +717,18 @@ 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([RSHIM_ADAPTER], ["x$can_build_rshim" = "xyes"],
|
||||
[internal error: validation should happen beforehand])
|
||||
PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])
|
||||
|
||||
AS_IF([test "x$enable_linuxgpiod" != "xno"], [
|
||||
build_bitbang=yes
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_remote_bitbang" != "xno"], [
|
||||
build_bitbang=yes
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno" -o "x$enable_nulink" != "xno"], [
|
||||
AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
|
||||
AM_CONDITIONAL([HLADAPTER], [true])
|
||||
@@ -774,7 +773,6 @@ AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "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"])
|
||||
AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
|
||||
AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
|
||||
AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
|
||||
AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
|
||||
@@ -786,7 +784,6 @@ AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
|
||||
AM_CONDITIONAL([USE_LIBGPIOD], [test "x$use_libgpiod" = "xyes"])
|
||||
AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
|
||||
AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
|
||||
AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
|
||||
AM_CONDITIONAL([DMEM], [test "x$build_dmem" = "xyes"])
|
||||
AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
|
||||
|
||||
@@ -873,11 +870,13 @@ m4_foreach([adapter], [USB1_ADAPTERS,
|
||||
HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
|
||||
LIBFTDI_USB1_ADAPTERS,
|
||||
LIBGPIOD_ADAPTERS,
|
||||
REMOTE_BITBANG_ADAPTER,
|
||||
LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
|
||||
LINUXSPIDEV_ADAPTER,
|
||||
VDEBUG_ADAPTER,
|
||||
JTAG_DPI_ADAPTER,
|
||||
JTAG_VPI_ADAPTER,
|
||||
RSHIM_ADAPTER,
|
||||
DUMMY_ADAPTER,
|
||||
OPTIONAL_LIBRARIES,
|
||||
COVERAGE],
|
||||
|
@@ -34,7 +34,10 @@ if RELEASE
|
||||
else
|
||||
%C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
|
||||
%C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"`cd $(top_srcdir) && git describe`\"
|
||||
%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`date +%F-%R`\"
|
||||
%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`DATE_FMT=+%F-%R; \
|
||||
SOURCE_DATE_EPOCH="$${SOURCE_DATE_EPOCH:-$$(date +%s)}"; \
|
||||
date -u -d "@$$SOURCE_DATE_EPOCH" "$$DATE_FMT" 2>/dev/null || \
|
||||
date -u -r "$$SOURCE_DATE_EPOCH" "$$DATE_FMT" 2>/dev/null || date -u "$$DATE_FMT"`\"
|
||||
endif
|
||||
|
||||
# add default CPPFLAGS
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include <helper/align.h>
|
||||
#include <helper/list.h>
|
||||
#include <helper/nvp.h>
|
||||
#include <helper/time_support.h>
|
||||
#include <jtag/jtag.h>
|
||||
@@ -52,6 +53,13 @@
|
||||
/* default halt wait timeout (ms) */
|
||||
#define DEFAULT_HALT_TIMEOUT 5000
|
||||
|
||||
struct target_event_action {
|
||||
enum target_event event;
|
||||
Jim_Interp *interp;
|
||||
Jim_Obj *body;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
static int target_read_buffer_default(struct target *target, target_addr_t address,
|
||||
uint32_t count, uint8_t *buffer);
|
||||
static int target_write_buffer_default(struct target *target, target_addr_t address,
|
||||
@@ -2194,12 +2202,11 @@ static void target_destroy(struct target *target)
|
||||
|
||||
jtag_unregister_event_callback(jtag_enable_callback, target);
|
||||
|
||||
struct target_event_action *teap = target->event_action;
|
||||
while (teap) {
|
||||
struct target_event_action *next = teap->next;
|
||||
struct target_event_action *teap, *temp;
|
||||
list_for_each_entry_safe(teap, temp, &target->events_action, list) {
|
||||
list_del(&teap->list);
|
||||
Jim_DecrRefCount(teap->interp, teap->body);
|
||||
free(teap);
|
||||
teap = next;
|
||||
}
|
||||
|
||||
target_free_all_working_areas(target);
|
||||
@@ -4608,6 +4615,7 @@ COMMAND_HANDLER(handle_target_write_memory)
|
||||
int jimretval = Jim_GetWide(CMD_CTX->interp, tmp, &element_wide);
|
||||
if (jimretval != JIM_OK) {
|
||||
command_print(CMD, "invalid value \"%s\"", Jim_GetString(tmp, NULL));
|
||||
free(buffer);
|
||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||
}
|
||||
|
||||
@@ -4662,7 +4670,7 @@ void target_handle_event(struct target *target, enum target_event e)
|
||||
struct target_event_action *teap;
|
||||
int retval;
|
||||
|
||||
for (teap = target->event_action; teap; teap = teap->next) {
|
||||
list_for_each_entry(teap, &target->events_action, list) {
|
||||
if (teap->event == e) {
|
||||
LOG_DEBUG("target: %s (%s) event: %d (%s) action: %s",
|
||||
target_name(target),
|
||||
@@ -4825,7 +4833,7 @@ bool target_has_event_action(const struct target *target, enum target_event even
|
||||
{
|
||||
struct target_event_action *teap;
|
||||
|
||||
for (teap = target->event_action; teap; teap = teap->next) {
|
||||
list_for_each_entry(teap, &target->events_action, list) {
|
||||
if (teap->event == event)
|
||||
return true;
|
||||
}
|
||||
@@ -4945,13 +4953,14 @@ no_params:
|
||||
{
|
||||
struct target_event_action *teap;
|
||||
|
||||
teap = target->event_action;
|
||||
/* replace existing? */
|
||||
while (teap) {
|
||||
list_for_each_entry(teap, &target->events_action, list)
|
||||
if (teap->event == (enum target_event)n->value)
|
||||
break;
|
||||
teap = teap->next;
|
||||
}
|
||||
|
||||
/* not found! */
|
||||
if (&teap->list == &target->events_action)
|
||||
teap = NULL;
|
||||
|
||||
if (goi->is_configure) {
|
||||
/* START_DEPRECATED_TPIU */
|
||||
@@ -4959,6 +4968,17 @@ no_params:
|
||||
LOG_INFO("DEPRECATED target event %s; use TPIU events {pre,post}-{enable,disable}", n->name);
|
||||
/* END_DEPRECATED_TPIU */
|
||||
|
||||
jim_getopt_obj(goi, &o);
|
||||
if (Jim_Length(o) == 0) {
|
||||
/* empty action, drop existing one */
|
||||
if (teap) {
|
||||
list_del(&teap->list);
|
||||
Jim_DecrRefCount(teap->interp, teap->body);
|
||||
free(teap);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
bool replace = true;
|
||||
if (!teap) {
|
||||
/* create new */
|
||||
@@ -4967,7 +4987,6 @@ no_params:
|
||||
}
|
||||
teap->event = n->value;
|
||||
teap->interp = goi->interp;
|
||||
jim_getopt_obj(goi, &o);
|
||||
if (teap->body)
|
||||
Jim_DecrRefCount(teap->interp, teap->body);
|
||||
teap->body = Jim_DuplicateObj(goi->interp, o);
|
||||
@@ -4985,8 +5004,7 @@ no_params:
|
||||
|
||||
if (!replace) {
|
||||
/* add to head of event list */
|
||||
teap->next = target->event_action;
|
||||
target->event_action = teap;
|
||||
list_add(&teap->list, &target->events_action);
|
||||
}
|
||||
Jim_SetEmptyResult(goi->interp);
|
||||
} else {
|
||||
@@ -5401,19 +5419,19 @@ COMMAND_HANDLER(handle_target_wait_state)
|
||||
COMMAND_HANDLER(handle_target_event_list)
|
||||
{
|
||||
struct target *target = get_current_target(CMD_CTX);
|
||||
struct target_event_action *teap = target->event_action;
|
||||
struct target_event_action *teap;
|
||||
|
||||
command_print(CMD, "Event actions for target %s\n",
|
||||
target_name(target));
|
||||
command_print(CMD, "%-25s | Body", "Event");
|
||||
command_print(CMD, "------------------------- | "
|
||||
"----------------------------------------");
|
||||
while (teap) {
|
||||
|
||||
list_for_each_entry(teap, &target->events_action, list)
|
||||
command_print(CMD, "%-25s | %s",
|
||||
target_event_name(teap->event),
|
||||
Jim_GetString(teap->body, NULL));
|
||||
teap = teap->next;
|
||||
}
|
||||
|
||||
command_print(CMD, "***END***");
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -5766,6 +5784,8 @@ static int target_create(struct jim_getopt_info *goi)
|
||||
|
||||
target->halt_issued = false;
|
||||
|
||||
INIT_LIST_HEAD(&target->events_action);
|
||||
|
||||
/* initialize trace information */
|
||||
target->trace_info = calloc(1, sizeof(struct trace));
|
||||
if (!target->trace_info) {
|
||||
|
@@ -139,7 +139,7 @@ struct target {
|
||||
*/
|
||||
bool running_alg;
|
||||
|
||||
struct target_event_action *event_action;
|
||||
struct list_head events_action;
|
||||
|
||||
bool reset_halt; /* attempt resetting the CPU into the halted mode? */
|
||||
target_addr_t working_area; /* working area (initialised RAM). Evaluated
|
||||
@@ -295,13 +295,6 @@ enum target_event {
|
||||
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X107 = 0x107,
|
||||
};
|
||||
|
||||
struct target_event_action {
|
||||
enum target_event event;
|
||||
Jim_Interp *interp;
|
||||
Jim_Obj *body;
|
||||
struct target_event_action *next;
|
||||
};
|
||||
|
||||
bool target_has_event_action(const struct target *target, enum target_event event);
|
||||
|
||||
struct target_event_callback {
|
||||
|
@@ -122,6 +122,7 @@ Jim_GetWide
|
||||
Jim_IncrRefCount
|
||||
Jim_InitStaticExtensions
|
||||
Jim_Interp
|
||||
Jim_Length
|
||||
Jim_ListAppendElement
|
||||
Jim_ListGetIndex
|
||||
Jim_ListLength
|
||||
|
Reference in New Issue
Block a user