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 <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8993 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
0d42f6a1b4
commit
c8e6746e9f
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user