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