-
Notifications
You must be signed in to change notification settings - Fork 18
Investigation into openocd integration #2
Description
Hi man, good work. I was looking to see whether something like this was already implemented in the stlink-v2->openocd->gdb toolchain, and found your work here. I was reading the source code of openocd tonight. The src/server/gdb_server.c sets a log callback function by calling log_add_callback in src/helper/log.c, which means that any part of openocd which wants to send a text message to GDB just has to call log_printf or log_printf_lf. This results in a packet sent by the gdbserver function gdb_output_con() to gdb. The packet is a VERBOSE REPLY which has a first byte of "O". The contents of the string are hex-encoded bytes. See for the protocol doc for example at
http://sourceware.org/gdb/talks/esc-west-1999/protocol.html.
So the easy integration for your ITM code into openOCD is to call log_printf with any received string, and it should get sent by openocd's gdb stub to be displayed in gdb.
Hopefully you can figure out the rest? I'm still inexperienced with the STM32 but I'd love to have ITM working for my programs.