I've managed to get debugging to work. However I cannot reset the board during debugging with gdb.
I think it may be caused by the flash configured for DDR mode by the application - when I reset the mcu, the flash is not reset and cannot be initialized.
I've modified the LinkServer driver to use a custom pin which works and I can flash, erase and debug. Is there another piece of code which must reflect the modified reset pin the LinkServer drivers? I found this line in "LinkServer-FlashDrivers.md"
FlexSPI Flash reset
A number of IMX RT MCUs that support external flash via the FlexSPI interface implement a flash device reset sequence.
During FlexSPI boot the boot process requires the FlexSPI Flash device to be in a certain mode, for example, 1-bit SPI compatible mode. The Flash
device will naturally be in this mode after a POR reset because the power-up sequence will reset it with the RT MCU device together. However, the
Flash device will not be in 1-bit SPI compatible mode if the flash device is configured to DPI mode or QPI mode or Octal mode when any non-POR
resets happen. In such case, special processing is required by the boot process to restore the Flash device to 1-bit SPI compatible mode before
continuing access to the Flash device. In general, this can be achieved by using a GPIO to assert a reset pin on the Flash device. The bootloader
can perform the reset process and reset the Flash device to 1-bit SPI compatible mode based on fuses configuration, using the GPIO specified by
the combination of FLEXSPI_RESET_PIN_PORT and FLEXSPI_RESET_PIN_GPIO.
When starting a flash-resident debug session this reset sequence may need to be performed by the flash driver as well. Flash drivers for IMX
RT500 and RT600 MCUs implement this functionality.
Note: Custom boards may not be wired identical to EVK development boards in regards to the actual pin dedicated to flash device reset. In such
cases the pre-connect script needs to be modified in order to pass to the flash drivers the relevant information about the GPIO pin used for flash
reset.
What does "flash-resident debug session" mean in this context? I was not able to find a dedicated reset function in the LinkServer algorithm for MIMXRT1170, which I used as a base. The only time a reset is performed is in the `uint32_t Init(void)` function.