41CL MMU Backup
|
05-30-2020, 06:47 PM
Post: #13
|
|||
|
|||
RE: 41CL MMU Backup
There is a chicken-and-egg problem no matter what you do:
Any code writing to Flash MUST be executed out of RAM, because Flash memory does not support simultaneous reading and writing. Flash writes require a SEQUENCE of write transactions on the bus, which requires that the CPU fetch a bunch of instructions to create the sequence. This sequence cannot be interleaved with instruction fetches, so the code doing the write MUST be resident in RAM. In YFNZ, the way to make the code resident in RAM is to copy the entire image to a RAM page and then reprogram the MMU to use that page. Saving page 804, which contains the MMU registers, is going to capture this MMU reprogramming. So when this capture is restored YFNZ better be resident in RAM, in the same page as before, when you enable the MMU or you will be screwed. Or, you have to manually change the MMU back to point at the Flash version of YFNZ BEFORE you enable the MMU. In YFNX, the code automatically copies a very small section (128 bytes) of code to RAM, reprograms the MMU to point Page 4 at this code, and then executes that code to do the Flash write. Once done, the MMU is reprogrammed back to what it was and the user is none the wiser. But the same problem still exists: this time it's the Page 4 MMU programming that is screwed up on the restore. So in this case you have to manually change the MMU for Page 4, either to something innocuous (0000) or to point at Library-4 (8120). In either case, only ONE location needs to be repaired, and everything else should be fine. There IS a way to avoid these problems that I just thought of: Copy the entire page 804 to another page of RAM and THEN backup THAT copy. If you do this BEFORE you start the RAM version of YFNZ everything is fine. And everything is fine when using YFNX because you are again backing up a snapshot of Page 804 rather than the actual Page 804. As far as determining what kind of Flash device you have, if you are running the latest version of YFNX, simply run "41CL" for a report on the size and organization of the Flash device on the board. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)