I've got the network bootloader working!
Thanks SIX1 for sharing your code, but I found that the whole task depends a lot from the HW and the rest of the project.
Different ext. EEPROM use differend ways to be read or to be written, for example.
I use a 24AA1025 (128Kx8 I²C).
The most tricky part for me was to create a PC software to transfer the .hex file. So I asked a friend to write it and he did!
My project is hughe and I cannot just copy the update parts to show you.
But I can encourage everyone to try it!
First find a way to get the Firmware into the ext.EEPROM. I send the hex-file line after line. Each line contains a checksum, very easy to check, see wikipedia "Intel Hex". I even check the address contained in each line to gain safety. After I send an "ACK" to the PC, the next line will be send.
The MSC bootloader sample appears less mystical after removing all the serial communication stuff.
Then I added "DIM bl_rqst as ERAM byte at &Hxx", both in the main application and the bootloader.
After loading the new hex-file into the ext. 1Mbit EEPROM and doing some checksum stuff, I write a 1 into that ERAM-var, and "reboot" the chip.
The BL starts and sees the "1". Now the bootloader copies the EEPROM content into the flash, resets the BL_rqst and resets the micro.
BTW, after getting this working, I re-added the MSC serial BL part and got an dual-bootloader.
One more hint: The intel-hex format offeres functional lines, setting the address-pointer and setting the block-number of 64KB-blocks.
Some hexfiles contain a first line, saying "Address = 0; Block = 0". This sets the main application reliably to the right values, even if the last transfer was aborted. Most hexfiles miss that line, so my PC-soft generates it at the beginnng of the transfer.
This is my (tested) idea of a network bootloader, the rest is up to you.
Thanks to all for getting me on the right track!
↧