Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
efb0b11
flash/nor/atsame5: add LAN9255 devices
hefloryd Jan 21, 2022
5e0cc43
tcl/board: Add EVB-LAN9255 config
hefloryd Jan 21, 2022
93f2276
aarch64: support for aarch32 ARM_MODE_UND
Jan 12, 2022
6541233
Combine register lists of smp targets.
timsifive Jul 9, 2021
dbbac5f
semihosting: use open mode flags from GDB, not from sys/stat.h
pavel-kirienko Jan 9, 2022
5ab74bd
semihosting: User defined operation, Tcl command exec on host
zedudi Nov 24, 2021
16cc853
target/smp: use a struct list_head to hold the smp targets
borneoa Dec 16, 2021
a11fe47
helper/list: add list_for_each_entry_direction()
borneoa Dec 16, 2021
49c40a7
target/riscv: revive 'riscv resume_order'
timsifive Dec 16, 2021
2a2636f
doxygen: fix some function prototype description
borneoa Jan 22, 2022
f998a2a
Cadence virtual debug interface (vdebug) integration
jacekmw8 Apr 6, 2021
7307fd0
gdb_server: Include thread name as XML attribute
benmcmorran Jan 27, 2022
2c0a65b
Fix small memory leak.
timsifive Jan 27, 2022
37d506a
server: remove remaining crust from dropped eCos code
borneoa Feb 2, 2022
2548835
rtos: threadx: Add hla_target support for ThreadX
benmcmorran Jan 27, 2022
94e7535
.gitmodules: switch away from repo.or.cz
borneoa Feb 2, 2022
2991232
flash/nor/stm32f2x: Fix erase of bank 2 sectors
ampleyfly Jan 17, 2022
10b5ac9
target/cortex_m: fix target_to_cm() helper
tom-van Nov 24, 2021
e4ba76a
target/armv7m,cortex_m: introduce checked arch_info cast routines
tom-van Nov 24, 2021
b53f5c2
target/cortex_m: add Cortex-M part number getter
tom-van Nov 25, 2021
13cd75b
flash/nor/stm32xx: fix segfault accessing Cortex-M part number
tom-van Nov 25, 2021
d673521
cpld: altera-epm240: Add additional IDCODEs
sean-anderson-seco Feb 11, 2022
b61eae1
cpld: altera-epm240: Increase adapter speed
sean-anderson-seco Feb 11, 2022
3fcfe4f
target: Add support for ls1088a
sean-anderson-seco Feb 11, 2022
d127866
target: ls1088a: Add service processor
sean-anderson-seco Feb 14, 2022
e84be70
board: Add NXP LS1088ARDB
sean-anderson-seco Feb 11, 2022
bc50b8f
gdb_server: fix double free
borneoa Feb 19, 2022
103b1d6
gdb_server: check target examined while combining reg list
borneoa Feb 19, 2022
8b740af
flash/stm32l4x: fix maybe-uninitialized compiler error
tarek-bochkati Feb 28, 2022
7b69acf
Merge branch 'master' into from_upstream
timsifive Mar 1, 2022
fedcda1
Fix build.
timsifive Mar 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ 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([vdebug],
AS_HELP_STRING([--enable-vdebug], [Enable building support for Cadence Virtual Debug Interface]),
[build_vdebug=$enableval], [build_vdebug=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])
Expand Down Expand Up @@ -514,6 +518,12 @@ AS_IF([test "x$build_jtag_vpi" = "xyes"], [
AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
])

AS_IF([test "x$build_vdebug" = "xyes"], [
AC_DEFINE([BUILD_VDEBUG], [1], [1 if you want Cadence vdebug interface.])
], [
AC_DEFINE([BUILD_VDEBUG], [0], [0 if you don't want Cadence vdebug interface.])
])

AS_IF([test "x$build_jtag_dpi" = "xyes"], [
AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
], [
Expand Down Expand Up @@ -689,8 +699,9 @@ AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"])
AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes" -o "x$build_jtag_vpi" = "xyes"])
AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes" -o "x$build_jtag_dpi" = "xyes"])
AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"])
AM_CONDITIONAL([VDEBUG], [test "x$build_vdebug" = "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"])
Expand Down
68 changes: 68 additions & 0 deletions doc/openocd.texi
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,12 @@ produced, PDF schematics are easily found and it is easy to make.
@* A JTAG driver acting as a client for the JTAG VPI server interface.
@* Link: @url{https://github.com/fjullien/jtag_vpi}

@item @b{vdebug}
@* A driver for Cadence virtual Debug Interface to emulated or simulated targets.
It implements a client connecting to the vdebug server, which in turn communicates
with the emulated or simulated RTL model through a transactor. The current version
supports only JTAG as a transport, but other virtual transports, like DAP are planned.

@item @b{jtag_dpi}
@* A JTAG driver acting as a client for the SystemVerilog Direct Programming
Interface (DPI) for JTAG devices. DPI allows OpenOCD to connect to the JTAG
Expand Down Expand Up @@ -3345,6 +3351,41 @@ This value is only used with the standard variant.
@end deffn


@deffn {Interface Driver} {vdebug}
Cadence Virtual Debug Interface driver.

@deffn {Config Command} {vdebug server} host:port
Specifies the host and TCP port number where the vdebug server runs.
@end deffn

@deffn {Config Command} {vdebug batching} value
Specifies the batching method for the vdebug request. Possible values are
0 for no batching
1 or wr to batch write transactions together (default)
2 or rw to batch both read and write transactions
@end deffn

@deffn {Config Command} {vdebug polling} min max
Takes two values, representing the polling interval in ms. Lower values mean faster
debugger responsiveness, but lower emulation performance. The minimum should be
around 10, maximum should not exceed 1000, which is the default gdb and keepalive
timeout value.
@end deffn

@deffn {Config Command} {vdebug bfm_path} path clk_period
Specifies the hierarchical path and input clk period of the vdebug BFM in the design.
The hierarchical path uses Verilog notation top.inst.inst
The clock period must include the unit, for instance 40ns.
@end deffn

@deffn {Config Command} {vdebug mem_path} path base size
Specifies the hierarchical path to the design memory instance for backdoor access.
Up to 4 memories can be specified. The hierarchical path uses Verilog notation.
The base specifies start address in the design address space, size its size in bytes.
Both values can use hexadecimal notation with prefix 0x.
@end deffn
@end deffn

@deffn {Interface Driver} {jtag_dpi}
SystemVerilog Direct Programming Interface (DPI) compatible driver for
JTAG devices in emulation. The driver acts as a client for the SystemVerilog
Expand Down Expand Up @@ -5185,6 +5226,22 @@ when reset disables PLLs needed to use a fast clock.
@* After single-step has completed
@item @b{trace-config}
@* After target hardware trace configuration was changed
@item @b{semihosting-user-cmd-0x100}
@* The target made a semihosting call with user-defined operation number 0x100
@item @b{semihosting-user-cmd-0x101}
@* The target made a semihosting call with user-defined operation number 0x101
@item @b{semihosting-user-cmd-0x102}
@* The target made a semihosting call with user-defined operation number 0x102
@item @b{semihosting-user-cmd-0x103}
@* The target made a semihosting call with user-defined operation number 0x103
@item @b{semihosting-user-cmd-0x104}
@* The target made a semihosting call with user-defined operation number 0x104
@item @b{semihosting-user-cmd-0x105}
@* The target made a semihosting call with user-defined operation number 0x105
@item @b{semihosting-user-cmd-0x106}
@* The target made a semihosting call with user-defined operation number 0x106
@item @b{semihosting-user-cmd-0x107}
@* The target made a semihosting call with user-defined operation number 0x107
@end itemize

@quotation Note
Expand Down Expand Up @@ -9241,6 +9298,17 @@ To make the SEMIHOSTING_SYS_EXIT call return normally, enable
this option (default: disabled).
@end deffn

@deffn {Command} {arm semihosting_read_user_param}
@cindex ARM semihosting
Read parameter of the semihosting call from the target. Usable in
semihosting-user-cmd-0x10* event handlers, returning a string.

When the target makes semihosting call with operation number from range 0x100-
0x107, an optional string parameter can be passed to the server. This parameter
is valid during the run of the event handlers and is accessible with this
command.
@end deffn

@section ARMv4 and ARMv5 Architecture
@cindex ARMv4
@cindex ARMv5
Expand Down
3 changes: 3 additions & 0 deletions src/flash/nor/atsame5.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ static const struct samd_part same53_parts[] = {
{ 0x04, "SAME53J20A", 1024, 256 },
{ 0x05, "SAME53J19A", 512, 192 },
{ 0x06, "SAME53J18A", 256, 128 },
{ 0x55, "LAN9255/ZMX020", 1024, 256 },
{ 0x56, "LAN9255/ZMX019", 512, 192 },
{ 0x57, "LAN9255/ZMX018", 256, 128 },
};

/* Known SAME54 parts. */
Expand Down
10 changes: 4 additions & 6 deletions src/flash/nor/stm32f1x.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,14 @@ static int stm32x_write(struct flash_bank *bank, const uint8_t *buffer,
static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id)
{
struct target *target = bank->target;
struct cortex_m_common *cortex_m = target_to_cm(target);
uint32_t device_id_register = 0;

if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_FAIL;
return ERROR_TARGET_NOT_EXAMINED;
}

switch (cortex_m->core_info->partno) {
switch (cortex_m_get_partno_safe(target)) {
case CORTEX_M0_PARTNO: /* STM32F0x devices */
device_id_register = 0x40015800;
break;
Expand Down Expand Up @@ -659,15 +658,14 @@ static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id)
static int stm32x_get_flash_size(struct flash_bank *bank, uint16_t *flash_size_in_kb)
{
struct target *target = bank->target;
struct cortex_m_common *cortex_m = target_to_cm(target);
uint32_t flash_size_reg;

if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_FAIL;
return ERROR_TARGET_NOT_EXAMINED;
}

switch (cortex_m->core_info->partno) {
switch (cortex_m_get_partno_safe(target)) {
case CORTEX_M0_PARTNO: /* STM32F0x devices */
flash_size_reg = 0x1FFFF7CC;
break;
Expand Down
13 changes: 9 additions & 4 deletions src/flash/nor/stm32f2x.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ static int stm32x_erase(struct flash_bank *bank, unsigned int first,

for (unsigned int i = first; i <= last; i++) {
unsigned int snb;
if (stm32x_info->has_large_mem && i >= 12)
snb = (i - 12) | 0x10;
if (stm32x_info->has_large_mem && i >= (bank->num_sectors / 2))
snb = (i - (bank->num_sectors / 2)) | 0x10;
else
snb = i;

Expand Down Expand Up @@ -966,14 +966,14 @@ static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id)
* Only effects Rev A silicon */

struct target *target = bank->target;
struct cortex_m_common *cortex_m = target_to_cm(target);

/* read stm32 device id register */
int retval = target_read_u32(target, 0xE0042000, device_id);
if (retval != ERROR_OK)
return retval;

if ((*device_id & 0xfff) == 0x411 && cortex_m->core_info->partno == CORTEX_M4_PARTNO) {
if ((*device_id & 0xfff) == 0x411
&& cortex_m_get_partno_safe(target) == CORTEX_M4_PARTNO) {
*device_id &= ~((0xFFFF << 16) | 0xfff);
*device_id |= (0x1000 << 16) | 0x413;
LOG_INFO("stm32f4x errata detected - fixing incorrect MCU_IDCODE");
Expand Down Expand Up @@ -1011,6 +1011,11 @@ static int stm32x_probe(struct flash_bank *bank)
bank->num_prot_blocks = 0;
bank->prot_blocks = NULL;

if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_TARGET_NOT_EXAMINED;
}

/* if explicitly called out as OTP bank, short circuit probe */
if (stm32x_is_otp(bank)) {
if (stm32x_otp_is_f7(bank)) {
Expand Down
9 changes: 7 additions & 2 deletions src/flash/nor/stm32h7x.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,14 +759,18 @@ static int stm32x_read_id_code(struct flash_bank *bank, uint32_t *id)
static int stm32x_probe(struct flash_bank *bank)
{
struct target *target = bank->target;
struct cortex_m_common *cortex_m = target_to_cm(target);
struct stm32h7x_flash_bank *stm32x_info = bank->driver_priv;
uint16_t flash_size_in_kb;
uint32_t device_id;

stm32x_info->probed = false;
stm32x_info->part_info = NULL;

if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_TARGET_NOT_EXAMINED;
}

int retval = stm32x_read_id_code(bank, &stm32x_info->idcode);
if (retval != ERROR_OK)
return retval;
Expand Down Expand Up @@ -800,7 +804,8 @@ static int stm32x_probe(struct flash_bank *bank)
/* get flash size from target */
/* STM32H74x/H75x, the second core (Cortex-M4) cannot read the flash size */
retval = ERROR_FAIL;
if (device_id == DEVID_STM32H74_H75XX && cortex_m->core_info->partno == CORTEX_M4_PARTNO)
if (device_id == DEVID_STM32H74_H75XX
&& cortex_m_get_partno_safe(target) == CORTEX_M4_PARTNO)
LOG_WARNING("%s cannot read the flash size register", target_name(target));
else
retval = target_read_u16(target, stm32x_info->part_info->fsize_addr, &flash_size_in_kb);
Expand Down
29 changes: 22 additions & 7 deletions src/flash/nor/stm32l4x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1632,13 +1632,14 @@ static int stm32l4_write(struct flash_bank *bank, const uint8_t *buffer,

static int stm32l4_read_idcode(struct flash_bank *bank, uint32_t *id)
{
int retval;
int retval = ERROR_OK;
struct target *target = bank->target;

/* try reading possible IDCODE registers, in the following order */
uint32_t dbgmcu_idcode[] = {DBGMCU_IDCODE_L4_G4, DBGMCU_IDCODE_G0, DBGMCU_IDCODE_L5};

for (unsigned int i = 0; i < ARRAY_SIZE(dbgmcu_idcode); i++) {
retval = target_read_u32(bank->target, dbgmcu_idcode[i], id);
retval = target_read_u32(target, dbgmcu_idcode[i], id);
if ((retval == ERROR_OK) && ((*id & 0xfff) != 0) && ((*id & 0xfff) != 0xfff))
return ERROR_OK;
}
Expand All @@ -1647,12 +1648,16 @@ static int stm32l4_read_idcode(struct flash_bank *bank, uint32_t *id)
* DBGMCU_IDCODE cannot be read using CPU1 (Cortex-M0+) at AP1,
* to solve this read the UID64 (IEEE 64-bit unique device ID register) */

struct cortex_m_common *cortex_m = target_to_cm(bank->target);
struct armv7m_common *armv7m = target_to_armv7m_safe(target);
if (!armv7m) {
LOG_ERROR("Flash requires Cortex-M target");
return ERROR_TARGET_INVALID;
}

/* CPU2 (Cortex-M0+) is supported only with non-hla adapters because it is on AP1.
* Using HLA adapters armv7m.debug_ap is null, and checking ap_num triggers a segfault */
if (cortex_m->core_info->partno == CORTEX_M0P_PARTNO &&
cortex_m->armv7m.debug_ap && cortex_m->armv7m.debug_ap->ap_num == 1) {
if (cortex_m_get_partno_safe(target) == CORTEX_M0P_PARTNO &&
armv7m->debug_ap && armv7m->debug_ap->ap_num == 1) {
uint32_t uid64_ids;

/* UID64 is contains
Expand All @@ -1662,7 +1667,7 @@ static int stm32l4_read_idcode(struct flash_bank *bank, uint32_t *id)
*
* read only the fixed values {STID,DEVID} from UID64_IDS to identify the device as STM32WLx
*/
retval = target_read_u32(bank->target, UID64_IDS, &uid64_ids);
retval = target_read_u32(target, UID64_IDS, &uid64_ids);
if (retval == ERROR_OK && uid64_ids == UID64_IDS_STM32WL) {
/* force the DEV_ID to DEVID_STM32WLE_WL5XX and the REV_ID to unknown */
*id = DEVID_STM32WLE_WL5XX;
Expand Down Expand Up @@ -1700,11 +1705,21 @@ static const char *get_stm32l4_bank_type_str(struct flash_bank *bank)
static int stm32l4_probe(struct flash_bank *bank)
{
struct target *target = bank->target;
struct armv7m_common *armv7m = target_to_armv7m(target);
struct stm32l4_flash_bank *stm32l4_info = bank->driver_priv;
const struct stm32l4_part_info *part_info;
uint16_t flash_size_kb = 0xffff;

if (!target_was_examined(target)) {
LOG_ERROR("Target not examined yet");
return ERROR_TARGET_NOT_EXAMINED;
}

struct armv7m_common *armv7m = target_to_armv7m_safe(target);
if (!armv7m) {
LOG_ERROR("Flash requires Cortex-M target");
return ERROR_TARGET_INVALID;
}

stm32l4_info->probed = false;

/* read stm32 device id registers */
Expand Down
14 changes: 14 additions & 0 deletions src/helper/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,20 @@ static inline void list_splice_tail_init(struct list_head *list,
!list_entry_is_head(pos, head, member); \
pos = list_prev_entry(pos, member))

/**
* list_for_each_entry_direction - iterate forward/backward over list of given type
* @param forward the iterate direction, true for forward, false for backward.
* @param pos the type * to use as a loop cursor.
* @param head the head for your list.
* @param member the name of the list_head within the struct.
*/
#define list_for_each_entry_direction(forward, pos, head, member) \
for (pos = forward ? list_first_entry(head, typeof(*pos), member) \
: list_last_entry(head, typeof(*pos), member); \
!list_entry_is_head(pos, head, member); \
pos = forward ? list_next_entry(pos, member) \
: list_prev_entry(pos, member))

/**
* list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
* @param pos the type * to use as a start point
Expand Down
3 changes: 3 additions & 0 deletions src/jtag/drivers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ endif
if JTAG_VPI
DRIVERFILES += %D%/jtag_vpi.c
endif
if VDEBUG
DRIVERFILES += %D%/vdebug.c
endif
if JTAG_DPI
DRIVERFILES += %D%/jtag_dpi.c
endif
Expand Down
2 changes: 0 additions & 2 deletions src/jtag/drivers/jlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ static int jlink_flush(void);
* @param in A pointer to store TDO data to, if NULL the data will be discarded.
* @param in_offset A bit offset for TDO data.
* @param length Amount of bits to transfer out and in.
*
* @retval This function doesn't return any value.
*/
static void jlink_clock_data(const uint8_t *out, unsigned out_offset,
const uint8_t *tms_out, unsigned tms_offset,
Expand Down
2 changes: 0 additions & 2 deletions src/jtag/drivers/ulink.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,6 @@ static int ulink_get_queue_size(struct ulink *device,
* Clear the OpenULINK command queue.
*
* @param device pointer to struct ulink identifying ULINK driver instance.
* @return on success: ERROR_OK
* @return on failure: ERROR_FAIL
*/
static void ulink_clear_queue(struct ulink *device)
{
Expand Down
Loading