#59010 - tuLL - Fri Oct 28, 2005 12:14 am
Hello there
I have an EFA-Linker 512 Mb and have been trying to dump my firmware before doing flashme.
But I have a problem. EFA has a bug. When I write "ds.gba" roms in the Flashcart the loader doesn't allow me to change the save size, and so I only have 256Kb available which is 32 KB.
Natrium's firmwaredumper,
http://www.natrium42.com/blog/?p=20
dumps the firmware in chunks of 64 KB and so there's no way I can dump it.
I see 2 alternatives here, either change the dumper to make 8 dumps of 32 KB or write a dumper for the GBAMP.
I can't do either of those:| Will someone please help me?
Thank you very much in advance
#59023 - natrium42 - Fri Oct 28, 2005 3:00 am
Just put this somewhere before main() in arm7 template of the combined example.
Code: |
//////////////////////////////////////////////////////////////////////
#define SERIAL_CR (*(vuint16*)0x040001C0)
#define SERIAL_CR32 (*(vuint32*)0x040001C0)
#define SERIAL_DATA (*(vuint16*)0x040001C2)
#define SERIAL_DATA8 (*(vuint8*)0x040001C2)
#define SERIAL_ENABLE 0x8000
#define SERIAL_BUSY 0x80
#define SPI_DEVICE_POWER (0 << 8)
#define SPI_DEVICE_TOUCH (2 << 8)
#define SPI_BAUDRATE_2Mhz 1
#define SPI_BAUDRATE_1Mhz 2
//#define SPI_CONTINUOUS (1<<11)
//////////////////////////////////////////////////////////////////////
#define SERIAL_SELECT (1 << 11)
#define SERIAL_DEVICE_POWER (0 << 8)
#define SERIAL_DEVICE_FIRMWARE (1 << 8)
#define SERIAL_DEVICE_TOUCH (2 << 8)
#define KEY_X (1 << 10)
#define KEY_Y (1 << 11)
//////////////////////////////////////////////////////////////////////
void dump(u32 startaddr, u32 length) {
u8* a=(u8*)0xa000000;
int i;
REG_IME = 0; // disable interrupts (critical section)
while (SERIAL_CR & SERIAL_BUSY);
SERIAL_CR = 0x8900;
SERIAL_DATA = 3;
while (SERIAL_CR & SERIAL_BUSY);
SERIAL_DATA = (startaddr&0xff0000)>>16;
while (SERIAL_CR & SERIAL_BUSY);
SERIAL_DATA = (startaddr&0xff00)>>8;
while (SERIAL_CR & SERIAL_BUSY);
SERIAL_DATA = (startaddr&0xff);
while (SERIAL_CR & SERIAL_BUSY);
for(i=0;i<0x10000;i++) {
SERIAL_DATA = 0;
while (SERIAL_CR & SERIAL_BUSY);
a[i]=SERIAL_DATA;
}
REG_IME = 1; // enable interrupts
}
//////////////////////////////////////////////////////////////////////
|
You need to dump 0x40000 bytes. You could either modify this to write to a GBAMP or to dump to SRAM in chunks of 0x8000 bytes.
For example, you also could put the line "dump(0x00000, 0x8000);" into main() before the while loop. Compile and dump that single chunk. Then change to "dump(0x08000, 0x8000);" recompile and dump, etc... for all chunks. It's a bit tedious :P
It's better to write some GBAMP code.
_________________
www.natrium42.com
#59026 - tepples - Fri Oct 28, 2005 3:40 am
natrium42 wrote: |
It's better to write some GBAMP code. |
...which would be almost as simple as fopen(), fwrite(), fclose(), right?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#59028 - natrium42 - Fri Oct 28, 2005 4:28 am
tepples wrote: |
natrium42 wrote: | It's better to write some GBAMP code. |
...which would be almost as simple as fopen(), fwrite(), fclose(), right? |
Yep, since Chishm has done all the work :)
_________________
www.natrium42.com
#59069 - tuLL - Fri Oct 28, 2005 5:47 pm
Hi
Ok guys, I'll try it. I doubt I'll be able to program to the GBAMP as this will be my first venture at C++ and the DS. I've programmed on some other languages, mainly cientifically inclined, so I'll give it a try. And with a little help from friends maybe I can get it done this weekend.
I really don't like to have passme hanging on the back and am afraid of doing flashme without a backed up firmware.
Thanks a million!
#59974 - tuLL - Sun Nov 06, 2005 1:42 am
Well, the EFA guys beat me to it. They've updated their loader and now it supports up to 2048 sized saves.
Thanks again!
PS: Well, the new loader writes 256 whatever value I put there. Back to the drawing board:D
Last edited by tuLL on Sun Nov 06, 2005 2:12 pm; edited 1 time in total
#60013 - josath - Sun Nov 06, 2005 8:44 am
you could write a simple app, that just dumps one chunk of firmware at a time, and then waits for you to press a key. this way, you get a chunk, take the gba cart out & copy off the sram, put it back in, and get the next chunk. no need for recompiling, reflashing cart, restarting the ds.
#60032 - tuLL - Sun Nov 06, 2005 2:13 pm
josath wrote: |
you could write a simple app, that just dumps one chunk of firmware at a time, and then waits for you to press a key. this way, you get a chunk, take the gba cart out & copy off the sram, put it back in, and get the next chunk. no need for recompiling, reflashing cart, restarting the ds. |
Heya
The problem is not the work it gives me, as I'll do it only once. The problem is making it:D
I'll keep trying, trial and error.
Thank you all for your support.