Ages back I started working on a mechanism to allow fast loading of programs via the serial monitor interface, but never finished it.
The idea was to add a command to the serial monitor interface that allowed bulk up-loading of data into memory, and trapping the LOAD vector so that it triggered this mechanism. Funnily enough, trapping LOAD from the serial monitor, working out which program to load, and loading it was the easy part. This has been in monitor_load.c for some time now.
The hard part was working out why what should have been a very simple memory upload command wasn't working.
Well, I finally figured out the problem with this command last night, and fixed it. The problem, as is so often the case, turned out to be quite simple: There was a safety catch that reset the UART monitor to CPU request strobe whenever a character was received via the UART interface. This is normally fine, but in bulk upload, this was cancelling the request to write the byte to memory each and every time it was made, resulting in timeout errors in the UART monitor, and a complete lack of loading of the data.
So I fixed this problem, and now I can easily write ranges of memory with arbitrary via the UART interface, at approximately 20KB/sec, since I am running the serial interface at 230,400bps.
The nice thing is that I also worked out how to jtag program the FPGA via the USB lead which also carries the serial monitor interface. This means that I can write a small shell script that pushes a bitstream into the FPGA and resets the machine, and then waits for someone to try to LOAD something, and then loads what you want at 20KB/sec. This is a really nice advance for writing software for the MEGA65, as from a cross-compiler you will be able to start the program automatically on a clean machine in just a few seconds. If nothing else, it means that you won't have to fiddle about pulling microSD cards out any more.
You might have noticed I used the future-tense there. This is because while I now have all the pieces mostly ready, I haven't finished pulling them together. I hope to do this over the next few evenings, time and energy permitting.
What I have managed to do, however, is to make the serial interface speed run-time selectable from the serial monitor itself. This means that we don't have to be limited to 20KB/sec, which while nice, would still take a few seconds to load 64KB, and a rather annoying dozen seconds to load 256KB (128KB normal RAM, plus 128KB of "ROM" RAM), when testing larger programs.
There isn't too much to see at the moment, except if you were to try my new bitstream and issue the command:
+32
from the UART monitor interface. At that point you would see rubbish, until you set your terminal program to 1,000,000bps, i.e., a little better than four times the current speed, and thus allowing something like 80KB - 100KB/sec, which should allow for nice fast loading of all of memory.
So then I tried:
+18
to set it to 2,000,000bps. That seems to work, too, and should allow ~160KB - 200KB/seconds. Even nicer. Sadly +10 didn't work for trying to set it to 3,000,000bps.
Oh well.
Anyway, hopefully I will have an update in a few days showing the ability to fast-load close to 200KB/sec in a development environment, to make writing MEGA65 software more pleasant to do.
No comments:
Post a Comment