I have a 32F417 project which has a 4MB Adesto SPI FLASH, 512 byte sectors, AT45DB321E, and you can have various device profiles on the USB client. In my case I have CDC (VCP port) and MSC (2MB FAT12 removable drive).
USB MSC is what you want.
ST Cube MX can generate most of the code for you for MSC profile, and you just need to write the interface to your FLASH. The above device is ideal because Windows wants to see 512 byte sectors.
Still, a fair bit of work, but MSC is a lot easier than CDC.
I posted various threads here about this, a few years ago. Sector write is 15ms, read is about 200us. If you dig them out, that will help you. Bits of code there, also how to implement a Busy state to the host.
The entire ST USB code is interrupt driven so you don't need an RTOS for that.