Building a USB bootloader for an STM32

Great article, but you need to clarify some things.

1A) You didn't say what you used to compile the ARM code, or version number of the tools either.

2A) You need to clarify that the STM32L052 already has a factory ROM'ed bootloader that supports UART & SPI bus, and bootloaders in other STM32 parts may support USB and I2C too. ARM microcontrollers from other ARM chip makers may not have any ROM'ed bootloader, nor does 8-bit AVR chips used in the Arduino. The STM32 factory ROM'ed bootloader is an important detail, because lots of people aren't aware they exist. See STM32 App Note AN2606 for more details. https://www.st.com/resource/en/application_note/CD00167594.pdf

3A) Since you said you got better performance from USB than SWD, then it's important to clarify some details that can affect the SWD speed.

3B) You didn't say how fast the ARM core is running. Though the STM32L052 can run up to 32 MHz, it doesn't mean that you configured it to run at 32 MHz, because you didn't state it. Depending on an ARM core, typically the maximum SWD clock speed is derived from the speed of the core, for example it might be 1/4 of the core clock, but I'm not sure how the limit is derived on the STM32L052.

3C) Though you are using a STLink for SWD speed comparison, it doesn't mean another SWD adapter wouldn't be faster. I'm not sure what is the maximum SWD clock speed of the STLink, but the maximum SWD clock speed can vary from model to model from other vendors. For example, the Segger JLink family has different clock rate limitations across the JLink family. https://en.wikipedia.org/wiki/Segger_Microcontroller_Systems#J-Link

/r/TheAmpHour Thread Link - kevincuzner.com