This is an automated email from Gerrit. "zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8993
-- gerrit commit 0ea8c76579de0f1f42e0964f79aee1946c60a41b Author: Marc Schink <d...@zapb.de> Date: Tue Jul 8 07:17:19 2025 +0000 rtt: Consider target endianness Consider target endianness when reading control block and channel information. Current implementation fails on big-endian devices. Tested on TMS570 (big-endian) and on nRF52 (little-endian). Note that in its current implementation RTT does not work properly on TMS570 due to its missing support for background memory access. Change-Id: Iab58804c42c85a932a750201a69ded35cebedd5d Signed-off-by: Marc Schink <d...@zapb.de> diff --git a/src/target/rtt.c b/src/target/rtt.c index 5ce049ae18..a8ab24a60b 100644 --- a/src/target/rtt.c +++ b/src/target/rtt.c @@ -37,12 +37,12 @@ static int read_rtt_channel(struct target *target, return ret; channel->address = address; - channel->name_addr = buf_get_u32(buf + 0, 0, 32); - channel->buffer_addr = buf_get_u32(buf + 4, 0, 32); - channel->size = buf_get_u32(buf + 8, 0, 32); - channel->write_pos = buf_get_u32(buf + 12, 0, 32); - channel->read_pos = buf_get_u32(buf + 16, 0, 32); - channel->flags = buf_get_u32(buf + 20, 0, 32); + channel->name_addr = target_buffer_get_u32(target, buf + 0); + channel->buffer_addr = target_buffer_get_u32(target, buf + 4); + channel->size = target_buffer_get_u32(target, buf + 8); + channel->write_pos = target_buffer_get_u32(target, buf + 12); + channel->read_pos = target_buffer_get_u32(target, buf + 16); + channel->flags = target_buffer_get_u32(target, buf + 20); return ERROR_OK; } @@ -230,10 +230,8 @@ int target_rtt_read_control_block(struct target *target, memcpy(ctrl->id, buf, RTT_CB_MAX_ID_LENGTH); ctrl->id[RTT_CB_MAX_ID_LENGTH - 1] = '\0'; - ctrl->num_up_channels = buf_get_u32(buf + RTT_CB_MAX_ID_LENGTH + 0, - 0, 32); - ctrl->num_down_channels = buf_get_u32(buf + RTT_CB_MAX_ID_LENGTH + 4, - 0, 32); + ctrl->num_up_channels = target_buffer_get_u32(target, buf + RTT_CB_MAX_ID_LENGTH + 0); + ctrl->num_down_channels = target_buffer_get_u32(target, buf + RTT_CB_MAX_ID_LENGTH + 4); return ERROR_OK; } --