Dear OpenOCD team, I am writing to you with a question why OpenOCD sometimes finds the RTT control block on an invalid address. Until now I happily used the openOCD for about 3 years during my development, but recently I encountered a problem that I am not able to solve.
To be more specific, I built a binary file with the RTT control block at address *0x20006878*, but for some reason OpenOCD finds the RTT control block at an address smaller by one byte than is the actual address ( *0x20006877*) that leads to nonfunctional communication. I was able to make OpenOCD work (still with the same binary file) by changing the start of the searched memory sector, but I am planning to prevent any future changes of the start command, so this workaround would not solve my problem. Used setup: - MCU: *stm32f407zgt6* - JTAG adapter: *st-link/v2* - OpenOCD version: *0.11.0-00155-ge392e485e (2021-03-15-16:44)* In the image shown below, there is a program output when using following command where I specify the start address 0x20000000 and count of searched bytes 192 kB: *Command to start openOCD that leads to an invalid address of the found RTT control block:* *bin\openocd.exe -s "scripts" -f "board/st_nucleo_f4.cfg" -f "interface/rtt.cfg" -c "gdb_port disabled" -c "tcl_port disabled" -c "rtt setup 0x20000000 196608 \"SEGGER RTT"" -c "rtt server start 9090 0" -c "init" -c "reset"* [image: image.png] As you can see, OpenOCD found the RTT control block at an unaligned memory address *0x20006877 *that leads to nonfunctional communication. I checked in the ".map file" and also during debugging and the actual address of the control block with ID "SEGGER RTT" is truly at the address *0x20006878.* During several attempts to find the problem I just changed the start address of the searched memory sector from 0x20000000 to 0x20000021 (without modifying the binary file or anything else) and the OpenOCD found the RTT control block address correctly as is shown below. *Command to start openOCD that leads to a valid address of the found RTT control block:* *bin\openocd.exe -s "scripts" -f "board/st_nucleo_f4.cfg" -f "interface/rtt.cfg" -c "gdb_port disabled" -c "tcl_port disabled" -c "rtt setup 0x20000021 196608 \"SEGGER RTT"" -c "rtt server start 9090 0" -c "init" -c "reset"* [image: image.png] I will be glad for any help. Best regards, Ondra