This is an automated email from Gerrit. Paul Fertser (fercer...@gmail.com) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/2537
-- gerrit commit c818a49a7f85d0fed30472b3e227fbe3547dc50f Author: Paul Fertser <fercer...@gmail.com> Date: Mon Feb 9 16:51:33 2015 +0300 contrib/itmdump: add a hack to allow direct dumping of specific SWIT Currently itmdump is not a production-quality code anyway hence this hack seems to be appropriate. This adds a new command line option -d N where N is a stimulus number you want to dump (counting from 1). The idea here is that if you're interested to live-monitor just a single stimulus port, you can use this utility directly. If one wants to demultiplex the TPIU stream, the following is proposed: 1. Find or write an utility that can accept binary data from a file/pipe/stdin and arbitrary number of TCP connections. It should simply mirror all the incoming data to all the accepted connections; 2. Use socat to connect itmdump to the proxy mentioned in 1. and then either dump the results to separate files or share via their dedicated TCP ports (similar to what http://openocd.zylin.com/1662 does). Change-Id: Iaeb102436eaa5b106002083f2ffe758fb7bd83e5 Signed-off-by: Paul Fertser <fercer...@gmail.com> diff --git a/contrib/itmdump.c b/contrib/itmdump.c index 9d313ff..807996b 100644 --- a/contrib/itmdump.c +++ b/contrib/itmdump.c @@ -44,6 +44,7 @@ #include <string.h> #include <unistd.h> +unsigned int dump_swit; /* Example ITM trace word (0xWWXXYYZZ) parsing for task events, sent * on port 31 (Reserved for "the" RTOS in CMSIS v1.30) @@ -59,6 +60,9 @@ static void show_task(int port, unsigned data) unsigned code = data >> 16; char buf[16]; + if (dump_swit) + return; + switch (code) { case 0: strcpy(buf, "run"); @@ -87,6 +91,9 @@ static void show_reserved(FILE *f, char *label, int c) { unsigned i; + if (dump_swit) + return; + printf("%s - %#02x", label, c); for (i = 0; (c & 0x80) && i < 4; i++) { @@ -146,6 +153,9 @@ static void show_hard(FILE *f, int c) unsigned size; char *label; + if (dump_swit) + return; + printf("DWT - ", type); if (!read_varlen(f, c, &value)) @@ -247,6 +257,15 @@ static void show_swit(FILE *f, int c) unsigned value = 0; unsigned i; + if (port + 1 == dump_swit) { + if (!read_varlen(f, c, &value)) + return; + printf("%c", value); + return; + } + if (dump_swit) + return; + printf("SWIT %u - ", port); if (!read_varlen(f, c, &value)) @@ -275,6 +294,9 @@ static void show_timestamp(FILE *f, int c) char *label = ""; bool delayed = false; + if (dump_swit) + return; + printf("TIMESTAMP - "); /* Format 2: header only */ @@ -356,7 +378,7 @@ int main(int argc, char **argv) int c; /* parse arguments */ - while ((c = getopt(argc, argv, "f:")) != EOF) { + while ((c = getopt(argc, argv, "f:d:")) != EOF) { switch (c) { case 'f': /* e.g. from UART connected to /dev/ttyUSB0 */ @@ -366,6 +388,9 @@ int main(int argc, char **argv) return 1; } break; + case 'd': + dump_swit = atoi(optarg); + break; default: usage: fprintf(stderr, "usage: %s [-f input]", -- ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel