Cannot upload bootloader via USB port (DFU), but no problem via ST-LINK
Where to start...
I have mave made a bootloader (done this before), which is placed in the low end of the flash memory. The application is in the subsequent flash.
My board has a USB port and a DIP switch for forcing the BOOT input pin high. When I flip the DIP switch on, and power the board, I can connect STM32CubeProgrammer to the internal DFU bootloader via the USB port. I can also upload my application through the USB port. But when I try to upload my own bootloader, it fails. This is the output from STM32CubeProgrammer:

However, if I connect an ST-LINK programmer to the board, I can upload the very same file with no issues. Output from STM32CubeProgrammer:

Clearly, something starts to go wrong at "Not flash Memory: No erase done"
Just now, I upgraded STM32CubeProgrammer to the latest version (2.21.0), but this made no difference.
But why does it work with the ST-LINK programmer, and not through the USB port? And why can I upload the application through the USB port, but not the bootloader?
Can it have something to do with the bootloader using segments 0, 1 and 3, but not segment 2? Does the DFU bootloader dislike such things?
