IDE can't upload to Adafruit Metro M4 Express with customized boot loader

I've added the ability to install a firmware update stored in the QSPI flash chip on the Adafruit Metro M4 Express. The loader attempts to establish a serial connection a bit later than Adafruit's original version because the MCU's QSPI interface is used to check for the presence of an updated firmware image.

I know the Metro M4 Express's serial interface was a bit touchy before I modified the loader; many of the issues posted on Adafruit's forum ask how to resolve issues with it. But since my changes I can't upload programs via the IDE at all; Windows 10 either doesn't see the serial port or says that it wasn't recognized.

After I upload a program with the Segger Ozone debugger, Windows sees an unrecognized serial port. If I disconnect the debugger and cycle power on both my J-Link and target board, then connect Ozone to the running process Windows sees the serial port and I'm able to open a serial monitor.

This clunky process is time-consuming and annoying, so I'd like to learn what's going on here and resolve it. Does anyone have a suggestion for where to start, or know where I can find a good writeup on the timing involved in establishing the serial interface?

I haven't measured the delay I add when no firmware update is needed, but it's on tomorrow's agenda.

I've attached main.c from the bootloader with the function call I added highlighted with comments.

bootloaderMain.c (7.61 KB)