aboutsummaryrefslogtreecommitdiff
path: root/src/target/rtt.c
AgeCommit message (Collapse)AuthorFilesLines
2023-05-05target: rtt: include rtt.hAntonio Borneo1-0/+1
Let source file to include its file .h to validate the exported prototypes. Detected through 'sparse' tool. Change-Id: I8ae2f8f1fdaea5683e157247463533b17237e464 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7602 Tested-by: jenkins
2023-01-11rtt: fix corner-cases of finding control blockMarcin Niestroj1-20/+14
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>
2022-09-18openocd: fix SPDX tag format for files .cAntonio Borneo1-1/+1
With the old checkpatch we cannot use the correct format for the SPDX tags in the file .c, in fact the C99 comments are not allowed and we had to use the block comment. With the new checkpatch, let's switch to the correct SPDX format. Change created automatically through the command: sed -i \ 's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \ $(find src/ contrib/ -name \*.c) Change-Id: I6da16506baa7af718947562505dd49606d124171 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7153 Tested-by: jenkins
2022-07-23openocd: src/target: replace the GPL-2.0-or-later license tagAntonio Borneo1-13/+2
Replace the FSF boilerplate with the SPDX tag. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: I255ad17235ff1e01bf0aa4deed4d944e1d693ddb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7071 Tested-by: jenkins
2022-03-26openocd: include config.h in every file .cAntonio Borneo1-0/+4
Including config.h as first is required for every C file. Add it to the C files that still miss it. Change-Id: I1a210e7d3a854958a85a290b086ad8a9f5176425 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6856 Tested-by: jenkins
2020-12-02Add initial RTT supportMarc Schink1-0/+424
Real Time Transfer (RTT) is an interface specified by SEGGER based on basic memory reads and writes to transfer data bidirectionally between target and host. Every target that supports so called "background memory access", which means that the target memory can be accessed by the debugger while the target is running, can be used. RTT is especially of interest for targets which do not support Serial Wire Output (SWO) (e.g. ARM Cortex-M0) or where using semihosting is not possible (e.g. real-time applications) [1]. The data transfer is organized in channels where each channel consists of an up- and/or down-channel. See [2] for more details. Channels are exposed via TCP connections. One or more RTT server can be assigned to each channel to make them accessible to an unlimited number of TCP connections. The current implementation does not respect buffer flags which are used to determine what happens when writing to a full buffer. Note that the implementation is designed in a way that the RTT operations can be directly performed by an adapter (e.g. J-Link). [1] https://devzone.nordicsemi.com/tutorials/6/ [2] https://www.segger.com/jlink-rtt.html Change-Id: I8bc8a1b381fb74e08b8752d5cf53804cc573c1e0 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/4055 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>