[STM32 USB training - 11.3 USB MSC DFU host labs] Does the current code not fit?
Hello,
I'm trying to reproduce this tutorial:
[STM32 USB training - 11.3 USB MSC DFU host labs]
https://www.youtube.com/watch?v=CGUC1wqSLCE
(Note: The original code is available in the video description)
I'm not able to make the final code run (flashing the led, lit for 100ms).
After trying to manually load using ST-Link, I noticed that the code size of the first program is larger than the flash range between 0x0800000 and 0x08007FFF.
This program reads the image.bin file from the USB flash drive and writes the contents of the image.bin file from the address 0x08008000 of the flash memory.
Apparently this first part works, but it no longer fits inside the 2 sectors (32K; 0x8000) that were initially reserved to operate as a bootloader.
When looking at the original code, using the STM32CubeProgrammer, we see that this code has only 0x610C (ie it is below 0x8000).
The code generated in release mode in STM32CubeIDE 1.9.0 has the size: 0x8040.
I tried to disable the USB debug and the serial port, but even then in debug mode the code is still this size: 0xB930. Only in release mode it has this usable size: 0x5F0C.
I'm commenting that if someone tries to reproduce this tutorial, it may no longer work just using 32K initials.
I believe this is not a BUG, but it would be very interesting if there was a way to select a Bootloader mode to be able to make the DFU code smaller, perhaps fitting into just one sector (16K), instead of having to use more memory for bootloader.

