From STLinux 2.2 onwards, it is possible to debug the ST40 Linux kernel over a JTAG connection using an ST Micro Connect. This has several advantages over kernel debugging with KGDB.
Another key advantage is that it requires almost no setup.
The ST40 debugger provided with STLinux 2.2 and later, sh4-linux-gdb, contains a Linux Awareness Layer, which understands the Linux virtual memory system and allows full JTAG debugging of kernel code and kernel modules.
Important note: the JTAG connection can not be used to debug code running in userspace. Instead, effective multi-threaded userspace debugging can be achieved using gdbserver.
There should be no problem with the order of power up between the host machine and the ST Micro Connect. However, STMicroelectronics recommend that the ST Micro Connect is always powered up before the target board, or that the target is reset after power up of the ST Micro Connect.
The reason for this is that when the ST Micro Connect is unpowered, the ribbon cable connection between the target and the ST Micro Connect can create a situation where the JTAG signals are transiently undefined. If this occurs, a target reset should clear any invalid state.
This applies to all types of ST Micro Connect (STMC1, STMC2 and STMCLite).