blob: 1ff0bd1ea2544bf190c018610a7e9a5a64cc4fd5 [file] [log] [blame]
Brian Silverman4787a6e2018-10-06 16:00:54 -07001#ifndef MOTORS_PRINT_ITM_
2#define MOTORS_PRINT_ITM_
3
4#include "motors/print/print.h"
5
6namespace frc971 {
7namespace motors {
8
9// A printing implementation via the SWO (trace output) pin. This requires an
10// attached debugger which is in SWD (Single Wire Debug) mode, has the SWO
11// (also known as JTAG_TDO) pin hooked up, and software support.
12//
13// To decode the output from this, use motors/print/itm_read.py.
14// To configure openocd to feed data to that:
Brian Silverman5a4f9782018-10-28 12:48:46 -070015// tpiu config internal /tmp/itm.fifo uart off 120000000 192000
Brian Silverman4787a6e2018-10-06 16:00:54 -070016class ItmPrinting final : public PrintingImplementation {
17 public:
18 ItmPrinting();
19 ~ItmPrinting() override = default;
20
21 void Initialize() override {}
22
23 // This goes to stimulus port 0.
24 int WriteStdout(gsl::span<const char> buffer) override;
25 // This goes to stimulus port 1.
26 int WriteDebug(gsl::span<const char> buffer) override;
27};
28
29} // namespace motors
30} // namespace frc971
31
32#endif // MOTORS_PRINT_ITM_