This is probably a dumb question, but HEAR ME OUT. I'm currently using the SAM D21 XPRO USB Host MSC Bootloader example provided by Atmel (ASF3). I know most people here don't use ASF so I'll briefly explain the idea: Use a bootloader locating in flash to grab firmware from a USB and then to program the D21 using that firmware. The only issue with this is what happens if I need to change the bootloader code itself?
Some ideas I had:
- leave part of the firmware dedicated to scanning the USB (will be an SD card eventually) for update firmware so it can program the bootloader section of the board, but this seems like a bad solution because it's my understanding that most bootloaders are read only after they're programmed (as in the sector where the bootloader is kept). Plus this means I would have to add more code to this sector which would certainly increase the code size and bloat this sector.
- Have a sector before my bootloader that is basically a bootloader for the bootloader. (Am I making this harder than it has to be?)
The reason why this matters is I wont be able to program this once it is assembled. It will rely on firmware updates and firmware updates only. How do people normally manage the updating of a devices bootloader? Is it possible to just write over the old bootloader while that sector is being used?