I was very attracted by the practicality of bootloader. I wanted to use the FAT file system to store binfiles, but the hardware device size was not enough, so I had to streaking.
Binary files are burned through the serial port. There is no difficulty here, that is, the serial port is used to interrupt the reception of files. However, when storing data, pay attention to the Flash allocation format, the size of the w25q16 memory on each page is 256 bytes, with a total storage space of 2 MB. Therefore, to ensure continuous storage, you must store data in segments. Each time bytes are received, the data is stored at the next address. For example, if the initial address selected for the first time is 0x00, the address selected for the second time is 0x100, and the length is 0 x each time.
Shows the storage format.
Implement bootloader in spi_flash