It's hard to calculate precisely because it is spread around, but my code for PIC16F1454 is about 700 commands (give or take 100), which is approximately 10% of the available code memory.
That's impressive at just over 1Kbytes. Is it written in assembler? Someone on an MSP forum has reduced a TI MSP430 CD USB stack (in 'C') to 1.5K.
I have a test project here for stm32f413 with MSD HAL stack and Os compiled project is 20640b Og is approximately 2000b more. There is a lot more code in there than just the USB MSD but as I've commented out the init code for that I trust the linker that it has thrown that out.
Not so impressive! But I guess we aren't exactly comparing like for like.
For STM32F411 (with GCC set to compile for cortex m3 ISA), my USB soundcard project compiles to around 12.5k of code with space optimisations on. On -Og it is 14.5K.
On -Os, core USB modules is around 6K, USB audio device ~1K, startup + CMSIS around 2K, and application (with some floating point) 3.5K.
So 16K will be a squeeze. Perhaps if you can keep the USB driver code at -Os during development it is doable, but sounds to me like you want to buy 32K part for a development unit, and use the 16K on units you don't need debugging for.
14.5K is still an awful lot though compared to 1.5K. Again I guess it is a full featured implementation with robust error checking and handling etc. I had a closer look at the ATMEL SAMD11 example I compiled and the actual USB code is around 8000 bytes.
I also found an excellent ATMEL document, AVR4920 'ASF - USB Device Stack - Compliance and Performance Figures', which provides comprehensive performance information on their USB stack. It shows (see attached) code size of 6K bytes for a full speed CDC device on an ATxmega or an AT32UC3. I wish all manufacturers would supply similar information for their embedded firmware products.
I know Cortex code size can be a bit bigger than for some 8 or 16 bit processors but I'd like to think that 2 or 3K should be possible if 1 to 1.5K has been achieved on PICs and MSP430s.
And then there is the issue of USB id's. I believe that Microchip allow you to use one of theirs in your own PIC based USB product but do any others? ST? I know there are ways around having to pay $2k to get an official set of ids, but none of them are exactly ideal if you want to sell a product.
Apologies to the original poster if I have hijacked your thread, but you did post about MCUs with USB.