I am no longer able to establish a connection to my target board via JTAG after programming an LDR file to flash. How do I fix this, and restore my board to its previous state?
When an application written to flash causes the board to be incommunicable, it is typically due to the application interrupting the communication with the processor via JTAG. This can happen if the code causes the core to fault, and hang, or (in newer processors) if the code actively disables the JTAG connection, etc.
The first thing to try - if you have access to these pins on your custom hardware - is to try setting the Boot Mode pins to boot from a different source, and see if you can connect to your target correctly. Typically you should now be able to connect correctly using this alternate boot mode.
Alternatively, if there is no possibility of altering the Boot Mode pins, you can try holding the board in reset when connecting. In the 'Session'->'Session List' window, highlight your Session (but don't activate yet) then hold the target board in reset. Click 'Activate', wait about 1/2 a second then release the board from reset. This will stop the board from executing the code on Flash before the Emulator has a chance to try and connect. This method may need some trial and error to get the timing right.
Once a connection has been established, you should program the flash with a known-good image, or erase it.