Reputation: 49
I'm using an NXP LPC1769, which contains a Cortex-M3. So far, I've only been accessing it from the JTAG interface, but now I have to do it the other way around. An IT routine is supposed to read certain parts of the memory, and immediately send them out to the JTAG port. Is there a way to do this?
*UPDATE: After hours of research, I found something that might help: Cortex-M3 supports ITM (Instrumentation Trace Macrocell), which can send data through the TDO pin of the JTAG port. My question now is, how would one go about doing so? I only found debugger-specific applications of the ITM, where in my case, I want to be able to send specific JTAG messages (or write specific DP/AP registers) from the running application.
Upvotes: 3
Views: 1790
Reputation: 76
There are several ways you can do host I/O over the JTAG port. The first one I normally turn to is called semihosting. Semihosting uses processor breakpoints in order to provide the debugged board with IO to the host. The mechanism is explained a little more here: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471h/Bgbjjgij.html.
How you might enable semihosting on your debugger will change based on what tool you're using. For example, a thread for setting up semihosting in the LPCXpresso IDE can be found here: https://www.lpcware.com/content/forum/configure-lpcxpresso-use-semihosting and a guide for GNU Arm Eclipse can be found here: https://mcuoneclipse.com/2014/09/11/semihosting-with-gnu-arm-embedded-launchpad-and-gnu-arm-eclipse-debug-plugins/.
The downside to semihosting is that it is slow when compared to using ITM.
Another method, as you allude to in your question, is by using the ITM (Instrumentation Trace Macrocell) functionality. Unlike semihosting, the ITM can operate without waiting for the JTAG adapter to poll it for data if the SWO pin is enabled or a separate UART output has been configured. As with semihosting, the details will change based on the tools you're using.
A guide for using ITM as a standard output in the LPCXpresso IDE can be found here: https://www.lpcware.com/content/faq/lpcxpresso/how-use-itm-printf.
Upvotes: 2