traceswo: Provide command option for async swo.

This commit is contained in:
Uwe Bonnes 2017-10-26 15:11:55 +02:00
parent 3e3e450408
commit 93bc3a155a
2 changed files with 15 additions and 5 deletions

View File

@ -56,7 +56,7 @@ static bool cmd_hard_srst(void);
static bool cmd_target_power(target *t, int argc, const char **argv);
#endif
#ifdef PLATFORM_HAS_TRACESWO
static bool cmd_traceswo(void);
static bool cmd_traceswo(target *t, int argc, const char **argv);
#endif
#ifdef PLATFORM_HAS_DEBUG
static bool cmd_debug_bmp(target *t, int argc, const char **argv);
@ -75,7 +75,7 @@ const struct command_s cmd_list[] = {
{"tpwr", (cmd_handler)cmd_target_power, "Supplies power to the target: (enable|disable)"},
#endif
#ifdef PLATFORM_HAS_TRACESWO
{"traceswo", (cmd_handler)cmd_traceswo, "Start trace capture" },
{"traceswo", (cmd_handler)cmd_traceswo, "Start trace capture [(baudrate) for async swo]" },
#endif
#ifdef PLATFORM_HAS_DEBUG
{"debug_bmp", (cmd_handler)cmd_debug_bmp, "Output BMP \"debug\" strings to the second vcom: (enable|disable)"},
@ -277,10 +277,20 @@ static bool cmd_target_power(target *t, int argc, const char **argv)
#endif
#ifdef PLATFORM_HAS_TRACESWO
static bool cmd_traceswo(void)
static bool cmd_traceswo(target *t, int argc, const char **argv)
{
#if defined(STM32L0) || defined(STM32F3) || defined(STM32F4)
extern char serial_no[13];
#else
extern char serial_no[9];
traceswo_init();
#endif
uint32_t baudrate = 0;
(void)t;
if (argc > 1)
baudrate = atoi(argv[1]);
traceswo_init(baudrate);
gdb_outf("%s:%02X:%02X\n", serial_no, 5, 0x85);
return true;
}

View File

@ -22,7 +22,7 @@
#include <libopencm3/usb/usbd.h>
void traceswo_init(void);
void traceswo_init(uint32_t baudrate);
void trace_buf_drain(usbd_device *dev, uint8_t ep);
#endif