blob: 64e3092081ea8bab560a1b10408b4edbc4a6b093 [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"
Philipp Schrader790cb542023-07-05 21:06:52 -07005
Brian Silverman4787a6e2018-10-06 16:00:54 -07006#include "motors/print/print.h"
7
8namespace frc971 {
9namespace motors {
10
11// A printing implementation via the SWO (trace output) pin. This requires an
12// attached debugger which is in SWD (Single Wire Debug) mode, has the SWO
13// (also known as JTAG_TDO) pin hooked up, and software support.
14//
15// To decode the output from this, use motors/print/itm_read.py.
16// To configure openocd to feed data to that:
Brian Silverman5a4f9782018-10-28 12:48:46 -070017// tpiu config internal /tmp/itm.fifo uart off 120000000 192000
Brian Silverman4787a6e2018-10-06 16:00:54 -070018class ItmPrinting final : public PrintingImplementation {
19 public:
20 ItmPrinting();
21 ~ItmPrinting() override = default;
22
23 void Initialize() override {}
24
25 // This goes to stimulus port 0.
Austin Schuh7fe04492022-01-02 13:37:21 -080026 int WriteStdout(absl::Span<const char> buffer) override;
Brian Silverman4787a6e2018-10-06 16:00:54 -070027 // This goes to stimulus port 1.
Austin Schuh7fe04492022-01-02 13:37:21 -080028 int WriteDebug(absl::Span<const char> buffer) override;
Brian Silverman4787a6e2018-10-06 16:00:54 -070029};
30
31} // namespace motors
32} // namespace frc971
33
34#endif // MOTORS_PRINT_ITM_