Brian Silverman | 4787a6e | 2018-10-06 16:00:54 -0700 | [diff] [blame] | 1 | #ifndef MOTORS_PRINT_ITM_ |
| 2 | #define MOTORS_PRINT_ITM_ |
| 3 | |
| 4 | #include "motors/print/print.h" |
| 5 | |
| 6 | namespace frc971 { |
| 7 | namespace 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 Silverman | 5a4f978 | 2018-10-28 12:48:46 -0700 | [diff] [blame] | 15 | // tpiu config internal /tmp/itm.fifo uart off 120000000 192000 |
Brian Silverman | 4787a6e | 2018-10-06 16:00:54 -0700 | [diff] [blame] | 16 | class 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_ |