Well, I actually picked my pages carefully.
I'm using 3F as my boot code, vectors, and main loader area.
Then I use 3E as my 'interface/driver' area, and it appears down at 4000 and is always visible.
Then all the other pages are 'programs' that appear on a menu that is managed by the code on page 3F. The code finds all the programs and puts a list on the LCD. The user then selects from the list, and the appropriate pages is then 'swapped in' at 8000 and run.
One of the programs accesses an external device and picks up lots of data from
that device. What I did is write a small Flash File System that is 'managed' inside the program, but puts all the drivers for it on page 3E. The calls to the drivers on page 3E 'swap out' the program page and swap in the data page (which happens to be 38) to do any reads or writes. All transfers take place through an SRAM buffer area.
Everything works. Well, at least to the point I'm at so far.
To get started, I just defined a 'dummy' data page when I built the code. From my program I can erase entries on the page (I overwrite them with 00 fields) and I can add new data. I can walk the data and really do anything I want.
Well, mostly.
First off, I cannot get the CodeWarrior debugger to even show the flash pages. It will show what is there when I program the part, but it just will not update on the PC window through the BDM. However, I wrote a little 'flash walker' that shows what's there, so I KNOW it's working right.
That aside, I can read, write, and zero the flash data area. No problems. (Well, I had a few, but I managed to get around them.) What I CANNOT seem to do is erase the page. I have to erase half a page, and I do it by issuing a series of erase commands to 512byte blocks.
Actually, that works.
But once erased, I have to then put a 'frame header' at the start of the area, that way my program knows where the valid data is. (Think of it as a 'boot sector' on a floppy that describes the parameters of the floppy.) When I go to write it after an erase, it hangs.
If I try to 'single step' the flash routines, EVERYTHING hangs. The only way I've gotten anything to work is to put 'tracer code' in there that lets me know what is going on and how far it gets.
At this point, if CW worked, I think I'd be much further along. But even still, I SUSPECT that my erase is actually either leaving the flash in a state that touching it to try to program it gets it 'out of sequence' or it's just not done yet. And I think that when I try to single step CW, the BDM accessing the flash, or trying to, is also messing things up.