Bootloading without a bootloader host | Cypress Semiconductor
Bootloading without a bootloader host
I'm interested in writing a custom bootloader. Unfortunately for what I am trying to do, all of the bootloader examples I can find talk about customizing either (a) critical tasks that the bootloader services in a similar way to how the bootloadable services them or (b) the communications channel between the bootloader and a bootloader host program.
I'd like to write a bootloader that loads the new program from an SD card. In my bootloadable project I already have the SPI interface to the SD card, and a port of the FatFS file system library. I can read and write binary files to the SD card.
It seems like it should be possible (but I could use a hint as to how) to write a bootloader that works like this:
- See if there's an SD card. If not, skip to bootloadable.
- See if it contains a file named "\firmware\program.hex" (or cycad, whatever the extension should be). If not, skip to bootloadable.
- See if the checksum in the header of that file matches the checksum of the currently installed bootloadable. If not, skip to bootloadable. (Or some other fast is-it-already-installed check.)
- Copy the new program to flash one row at a time, using the same strategy that the ordinary Cypress-provided bootloader does.
Am I missing a reason why this can't work? The reason I'd like to do it this way is because it means that field updates don't need a computer or any other smart bootloader host, they just need my customer to stick in the card I mailed them.
Thanks in advance for any advice you may have.