Write PSRAM to EZ Flash 3 in 1
I am trying to figure out how to program PSRAM in EZ Flash 3 on a GBA 1 by 1 card. Basically repeat what GBA Exploader and other programs do.
If I select a block and program, then read it, the first half-word will always be 0x1500 or something, but the rest of the data is fine.
If in the record I select the previous block, start writing at 0x20000 bytes to that block (the block size from what I determined). Reading from the required block still shows that the first half-word is wrong, but the rest of the half-words are correct.
a source to share
I was close to that. I tried to back up one and then two blocks, but not three and that was the trick. Take a look at the end to see how many functions are written in 0x08000000, 0x08020000 and 0x08040000:
void OpenNorWrite()
{
*(vuint16 *)0x9fe0000 = 0xd200;
*(vuint16 *)0x8000000 = 0x1500;
*(vuint16 *)0x8020000 = 0xd200;
*(vuint16 *)0x8040000 = 0x1500;
*(vuint16 *)0x9C40000 = 0x1500;
*(vuint16 *)0x9fc0000 = 0x1500;
}
Corrupt data has always been 0x1500, which makes sense too.
The solution is to back up three (or more) blocks and the forwarding addresses of three (or more) blocks:
CloseNorWrite();
SetRompage(0x180-3);
OpenNorWrite();
rb=FLASHBASE+(0x20000*3);
for(ra=0;ra<(sizeof(prog)>>2);ra++)
{
rc=prog[ra];
PUT16(rb,(rc>> 0)&0xFFFF); rb+=2;
PUT16(rb,(rc>>16)&0xFFFF); rb+=2;
}
CloseNorWrite();
SetRomPage(0x180);
reboot();
a source to share