I would be very interested to find a bootloader on the DZ32 which could input directly the S19 file, my objective was to send directly the .s19 file with hyperterminal for example.
I've tried to write it but the two main problems Im 'unable to solve are :
1) Sector erase is quite long and hyperterminal doesn't wait for erase of sectors
2) I've tried to implement a Xon Xoff protocol to slow down flux of data incoming on the DZ32 but :
When hyperterminal receives a Xoff, it continues to send several bytes.
In my case, hyperterminal skips some bytes when receiving Xoff and then Xon
I've been unable to solve these problems (with ModBus the advantage is that the response is send only when the sectors are erased)
François
No offense, but I think you're drowning in a glass of water. Why don't you erase all sectors before you start programming? There, both of your problems solved.
I've written a bootloader that understands S19 files directly, so upgrades are simple copy-paste operations (copy the file from our web page and paste into whatever terminal emulator). It breezes at 57600 bps @ ~8MHz bus (for QE32/QE128, 38400 for QG8) using the internal oscillator.
The approach is this:
* Upon reset, the IRQ pin is tested for deliberate entry into the bootloader. If so, it enters boot mode.
* If no IRQ, then the CRC is computed and compared to an application/part specific location. If CRC fails, it enters boot mode.
* In boot mode, there are two commands: one to start the S19 loading, and the other to cause a reset.
* If IRQ pin is high and the CRC verifies, then the application is executed.
* Vectors are automatically redirected, so one writes the application as if it were stand-alone, being careful only to keep out of the last (two) pages of Flash where the bootloader is (except for vectors which are taken care of automatically).
When the S19 Load command is entered, the bootloader erases all Flash (you can have it erase only certain sections if you want to preserve user data between firmware upgrades -- this is application specific) and waits for S records. It then simply decodes, and programs each byte as it is received.
No interrupts are used, the CCR[I] bit is never cleared.
If ESC is pressed during the upgrade, the process is canceled, and you're back at the boot menu to try again.
Unfortunately due to proprietary decryption etc I cannot provide the (assembly language) code for this. Maybe at a later time, if I find the time to remove the proprietary stuff.