Page 1 of 1

Is redirecting stdout over JTAG possible?

Posted: Sat Dec 30, 2023 11:27 pm
by moefear85
Hi,

I've recently begun debugging esp32 through openocd/jtag. However, serial output is sent to UART0. Is it possible to send this data in-band over JTAG?

Re: Is redirecting stdout over JTAG possible?

Posted: Mon Jan 01, 2024 9:38 am
by RandomInternetGuy
The search terms you seek are "Semihosting" and "Segger RTT". From the name, you can guess that one company kind of drove the adoption, but it's a simple array of circular queues that allows for separate streams for stdin, stdout, files, console, and more.

I've not reviewed these articles in depth at this moment, but seemingly providing reasonable overviews at a glance, we have (at least):
https://www.codeinsideout.com/blog/stm3 ... #debugging
https://www.segger.com/products/debug-p ... -transfer/
https://www.segger.com/news/231109-pr-j-link-vscode/
https://stackoverflow.com/questions/380 ... bugging-fr

... and more. With a little work, you can create your serial console to shove data into the semihosting system, have openocd/jlink/gdb noticed that the tail pointers moved, shovel them over DMA, and then have clever software on the host side format it, syntax highlight it, display errors, or whatever floats your boat.

The basic process seemed to first be popularized on STM parts, but it's now on CH32, most ESP32 devices, and multiple RISC-V devices and cores. Each has some funky rules, but the process is recognizable everywhere.

Re: Is redirecting stdout over JTAG possible?

Posted: Wed Jan 03, 2024 9:46 am
by jackliu@zyate.com
I want to use the JTAG interface to update the ESP32-WROVER-E program. Do you have a burner with JTAG that can be used?