Compare commits

...

5 Commits

Author SHA1 Message Date
Paul Fertser
9ea7f3d647 The openocd-0.12.0 release
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2023-01-14 23:14:31 +03:00
Antonio Borneo
f71b5f5a37 configure.ac: fix check for jimtcl submodule
The file configure.ac checks if jimtcl submodule is present by
looking for the file jimtcl/configure.ac .
But jimtcl has switched to its own build system in 2011 and thus
dropped configure.ac . This cause a build issue on OpenOCD that
was incorrectly fixed by adding a dummy configure.ac in jimtcl.

Fix OpenOCD configure.ac to look for the correct file
jimtcl/configure .
After this fix, another fix would be proposed to jimtcl to drop
its useless dummy file configure.ac .

Change-Id: I705f72d83e374c8dd700baaa0c0bbe041f153605
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7437
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2023-01-14 20:06:11 +00:00
Antonio Borneo
d92ebb5ab4 jtag: esp_usb_jtag: remove macro __packed
In FreeBSB 13.0 the build fails due to redefined macro __packed.

	src/jtag/drivers/esp_usb_jtag.c:19:9: error: '__packed' macro
	    redefined [-Werror,-Wmacro-redefined]
	#define __packed __attribute__((packed))
	        ^
	/usr/include/sys/cdefs.h:223:9: note: previous definition is here
	#define __packed        __attribute__((__packed__))
	        ^
	1 error generated.

Drop the macro and align the code with the other files in OpenOCD
project, where the attribute is directly applied without using a
macro.

Change-Id: I89ae943e77036206d40d4d54172cd4a73e76e5c5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Wojciech Puchar <wojtek@puchar.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/7435
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2023-01-11 17:02:44 +00:00
Marcin Niestroj
7dd5b6a464 rtt: fix corner-cases of finding control block
This patch fixes two corner-cases of finding RTT control block.

The first one is when there was a partial match (even single byte) at
the end of loaded buffer (uint8_t buf[1024]), but this was not part of
full match. In that case `cb_offset` was not updated correctly and the
returned `*address` was lower by the legth of the partial match. In case
of searched 'SEGGER RTT' (the default control block ID) string, it was
enough to match `buf[1023] == 'S'`, which is quite likely to happen, and
the `*address` was offset by 1 (e.g. it was 0x20000fff instead of
0x20010000).

Updating (or even maintaining) `cb_offset` is not needed, as start
address of control block can be calculated based on memory address that
was loaded into `uint8_t buf[1024]`, the offset within this buffer and
the length of expected string.

The second issue is when control block is prepended with a byte that
matches first ID character, e.g. there is `SEGGER RTT` control block ID
is prepended by another `S`, making memory contents be `SSEGGER RTT`. In
that case there was no match found.

Fix that issue by making sure that tested byte is always compared with
first byte of expected control block ID.

While at it, change names of local variables to better describe their
meaning.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Change-Id: I12aa6e202bf12bedcbb888ab595751a2a2518a24
Reviewed-on: https://review.openocd.org/c/openocd/+/7429
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-11 17:02:25 +00:00
Paul Fertser
dfe57baa16 Restore +dev suffix
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2022-12-20 15:49:44 +03:00
4 changed files with 20 additions and 28 deletions

2
NEWS
View File

@@ -121,7 +121,7 @@ This release also contains a number of other important functional and
cosmetic bugfixes. For more details about what has changed since the
last release, see the git repository history:
http://sourceforge.net/p/openocd/code/ci/v0.12.0-rc3/log/?path=
http://sourceforge.net/p/openocd/code/ci/v0.12.0/log/?path=
For older NEWS, see the NEWS files associated with each release

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
AC_PREREQ([2.69])
AC_INIT([openocd], [0.12.0-rc3],
AC_INIT([openocd], [0.12.0],
[OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
AC_CONFIG_SRCDIR([src/openocd.c])
AC_CONFIG_AUX_DIR([build-aux])
@@ -574,7 +574,7 @@ AS_IF([test "x$enable_buspirate" != "xno"], [
])
AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
AS_IF([test -f "$srcdir/jimtcl/configure.ac"], [
AS_IF([test -f "$srcdir/jimtcl/configure"], [
AS_IF([test "x$use_internal_jimtcl_maintainer" = "xyes"], [
jimtcl_config_options="--disable-install-jim --with-ext=json --maintainer"
], [

View File

@@ -16,8 +16,6 @@
#include "bitq.h"
#include "libusb_helper.h"
#define __packed __attribute__((packed))
/*
Holy Crap, it's protocol documentation, and it's even vendor-provided!
@@ -110,7 +108,7 @@ descriptor.
struct jtag_proto_caps_hdr {
uint8_t proto_ver; /* Protocol version. Expects JTAG_PROTO_CAPS_VER for now. */
uint8_t length; /* of this plus any following descriptors */
} __packed;
} __attribute__((packed));
/* start of the descriptor headers */
#define JTAG_BUILTIN_DESCR_START_OFF 0 /* Devices with builtin usb jtag */
@@ -133,7 +131,7 @@ of caps header to assume this. If no such caps exist, assume a minimum (in) buff
struct jtag_gen_hdr {
uint8_t type;
uint8_t length;
} __packed;
} __attribute__((packed));
struct jtag_proto_caps_speed_apb {
uint8_t type; /* Type, always JTAG_PROTO_CAPS_SPEED_APB_TYPE */
@@ -141,7 +139,7 @@ struct jtag_proto_caps_speed_apb {
uint8_t apb_speed_10khz[2]; /* ABP bus speed, in 10KHz increments. Base speed is half this. */
uint8_t div_min[2]; /* minimum divisor (to base speed), inclusive */
uint8_t div_max[2]; /* maximum divisor (to base speed), inclusive */
} __packed;
} __attribute__((packed));
#define JTAG_PROTO_CAPS_DATA_LEN 255
#define JTAG_PROTO_CAPS_SPEED_APB_TYPE 1

View File

@@ -241,43 +241,37 @@ int target_rtt_find_control_block(struct target *target,
target_addr_t *address, size_t size, const char *id, bool *found,
void *user_data)
{
target_addr_t address_end = *address + size;
uint8_t buf[1024];
*found = false;
size_t j = 0;
size_t cb_offset = 0;
size_t id_matched_length = 0;
const size_t id_length = strlen(id);
LOG_INFO("rtt: Searching for control block '%s'", id);
for (target_addr_t addr = 0; addr < size; addr = addr + sizeof(buf)) {
for (target_addr_t addr = *address; addr < address_end; addr += sizeof(buf)) {
int ret;
const size_t buf_size = MIN(sizeof(buf), size - addr);
ret = target_read_buffer(target, *address + addr, buf_size, buf);
const size_t buf_size = MIN(sizeof(buf), address_end - addr);
ret = target_read_buffer(target, addr, buf_size, buf);
if (ret != ERROR_OK)
return ret;
size_t start = 0;
size_t i = 0;
while (i < buf_size) {
if (buf[i] != id[j]) {
start++;
cb_offset++;
i = start;
j = 0;
continue;
for (size_t buf_off = 0; buf_off < buf_size; buf_off++) {
if (id_matched_length > 0 &&
buf[buf_off] != id[id_matched_length]) {
/* Start from beginning */
id_matched_length = 0;
}
i++;
j++;
if (buf[buf_off] == id[id_matched_length])
id_matched_length++;
if (j == id_length) {
*address = *address + cb_offset;
if (id_matched_length == id_length) {
*address = addr + buf_off + 1 - id_length;
*found = true;
return ERROR_OK;
}