Fixing dfu.c to allow compiling with -Os

This fixes warnings and volatile variables, making the booloader working with -Os
Before this change, the bootloader was not able to upload any data with optimization enabled

This takes the bootloader size from ~16k to ~7k