Browse Source

Make baudrate parameter of traceswo command mandatory for stlink/swlink, and superfluous on other platforms; change help message accordingly.

pull/556/head
Thiadmer Riemersma 5 years ago
committed by UweBonnes
parent
commit
1924aa4999
  1. 26
      src/command.c
  2. 5
      src/platforms/common/traceswo.h
  3. 1
      src/platforms/stlink/platform.h
  4. 1
      src/platforms/stm32/traceswo.c
  5. 2
      src/platforms/stm32/traceswoasync.c
  6. 1
      src/platforms/swlink/platform.h

26
src/command.c

@ -77,7 +77,11 @@ 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 [(baudrate) for async swo]" },
#if defined TRACESWO_PROTOCOL && TRACESWO_PROTOCOL == 2
{"traceswo", (cmd_handler)cmd_traceswo, "Start trace capture, NRZ mode: (baudrate)" },
#else
{"traceswo", (cmd_handler)cmd_traceswo, "Start trace capture, Manchester mode" },
#endif
#endif
#if defined(PLATFORM_HAS_DEBUG) && !defined(PC_HOSTED)
{"debug_bmp", (cmd_handler)cmd_debug_bmp, "Output BMP \"debug\" strings to the second vcom: (enable|disable)"},
@ -356,13 +360,21 @@ static bool cmd_traceswo(target *t, int argc, const char **argv)
#else
extern char serial_no[9];
#endif
uint32_t baudrate = 0;
(void)t;
if (argc > 1)
baudrate = atoi(argv[1]);
traceswo_init(baudrate);
#if defined TRACESWO_PROTOCOL && TRACESWO_PROTOCOL == 2
if (argc > 1) {
uint32_t baudrate = atoi(argv[1]);
traceswo_init(baudrate);
} else {
gdb_outf("Missing baudrate parameter in command\n");
}
#else
(void)argv;
traceswo_init();
if (argc > 1) {
gdb_outf("Superfluous parameter(s) ignored\n");
}
#endif
gdb_outf("%s:%02X:%02X\n", serial_no, 5, 0x85);
return true;
}

5
src/platforms/common/traceswo.h

@ -22,7 +22,12 @@
#include <libopencm3/usb/usbd.h>
#if defined TRACESWO_PROTOCOL && TRACESWO_PROTOCOL == 2
void traceswo_init(uint32_t baudrate);
#else
void traceswo_init(void);
#endif
void trace_buf_drain(usbd_device *dev, uint8_t ep);
#endif

1
src/platforms/stlink/platform.h

@ -70,6 +70,7 @@
#define PLATFORM_HAS_TRACESWO 1
#define NUM_TRACE_PACKETS (128) /* This is an 8K buffer */
#define TRACESWO_PROTOCOL 2 /* 1 = Manchester, 2 = NRZ / async */
# define SWD_CR GPIO_CRH(SWDIO_PORT)
# define SWD_CR_MULT (1 << ((14 - 8) << 2))

1
src/platforms/stm32/traceswo.c

@ -33,6 +33,7 @@
*/
#include "general.h"
#include "cdcacm.h"
#include "traceswo.h"
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/timer.h>

2
src/platforms/stm32/traceswoasync.c

@ -30,7 +30,7 @@
#include "general.h"
#include "cdcacm.h"
#include "platform.h"
#include "traceswo.h"
#include <libopencmsis/core_cm3.h>
#include <libopencm3/cm3/nvic.h>

1
src/platforms/swlink/platform.h

@ -64,6 +64,7 @@
#define PLATFORM_HAS_TRACESWO 1
#define NUM_TRACE_PACKETS (128) /* This is an 8K buffer */
#define TRACESWO_PROTOCOL 2 /* 1 = Manchester, 2 = NRZ / async */
# define SWD_CR GPIO_CRH(SWDIO_PORT)
# define SWD_CR_MULT (1 << ((13 - 8) << 2))

Loading…
Cancel
Save