I know, bad idea but perhaps it may work, won't be able to try it for a few days. Any ideas welcome.
I'm using 2 bits of portc (JTAG pins) as startup settings, they will only be read once after reset.
So the idea is that JTAG would be enabled as per normal, after init JTAG would be disabled with the usual writing to JTD, this will switch the pins to input mode (but probably also crash the JTAG session).
Read the pins.
Re-eneable JTAG by writing 0 twice to JTD???
Continue with normal JTAG debugging...or not :?
Has anybody tried anything like this? Can JTAG be switched on/off during debug? It's unlikely but I can't see anything specific, only that JTD has to be 0 for JTAG to work.
Would "hot-plugging/unplugging" JTAG be allowable? It would be nice if it worked.