gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > External RAM test

#125960 - Lick - Wed Apr 18, 2007 4:09 pm

Update run this ram_test instead!
__________________________

http://lickr.org/files/exram.nds
http://lickr.org/files/exram.ds.gba

Hey, I've been working on my own external ram library and currently I have raw drivers for SC, Opera and M3. (Credits to Lazy1 for unlock codes).

Could everyone with those devices test the above linked files? I'm particularly interested in Opera and M3, and the amount of RAM the testapp will display.

Thanks,
- LIkc
_________________
http://licklick.wordpress.com


Last edited by Lick on Fri Apr 20, 2007 11:18 am; edited 2 times in total

#125967 - Stuk - Wed Apr 18, 2007 5:53 pm

I've tried it on a Supercard lite and got two green screens, bar: 1234, and total: 33554432

I also have the Opera expansion, is it possible to test this with the Supercard lite?

#125968 - oofrab - Wed Apr 18, 2007 6:02 pm

M3Lite here. Two green screens and upper shows:

init ram

bar: 1234
total: 33554432

#125969 - TheFish - Wed Apr 18, 2007 6:04 pm

Tested with my Supercard SD

Bar: 1234

Total: 33554432

The full 32 meg is accessable then I see to developers to use (32 x 1024 x 1024 bytes)

#125970 - InGeNus - Wed Apr 18, 2007 6:09 pm

tested opera with M3S. :
bar: 1234
total: 8388608

#125972 - Dennis - Wed Apr 18, 2007 6:28 pm

I have tested with original ram(opera ram cart)

Two green screens
Init ram

bar: 1234
total: 8388608

#125976 - Lick - Wed Apr 18, 2007 7:37 pm

Stuk: Because the ram initializes immediately when the program is loaded, you need very quick hands to swap the SCLite with Opera expansion! But if the ram is intialized on command like a key, then I think you can use Opera.

I test the first 2 bytes of every 1024-byte block to see how much ram is writable. That's how the total memory is calculated.

Good that it's working, now I'll write the memory manager.
_________________
http://licklick.wordpress.com

#125980 - Sektor - Wed Apr 18, 2007 8:01 pm

M3CF
bar: 1234
total: 33554432
_________________
GTAMP.com/DS

#125981 - tepples - Wed Apr 18, 2007 8:24 pm

Lick wrote:
I test the first 2 bytes of every 1024-byte block to see how much ram is writable. That's how the total memory is calculated.

But how does your program handle incomplete decoding? What if a card has 4 MiB of RAM, but the 4 MiB is "mirrored" or repeated throughout the 32 MiB address space?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#125983 - Lick - Wed Apr 18, 2007 8:55 pm

Hmm that could be a problem, although it seems like it hasn't occured yet.

Would erasing the checked location after each positive validation be a solution?
_________________
http://licklick.wordpress.com

#125985 - tepples - Wed Apr 18, 2007 10:07 pm

Lick wrote:
Would erasing the checked location after each positive validation be a solution?

What you'll want to do after you determine which kilobytes of address space have RAM in them is write a canary value (e.g. 0xDEADBEEF) to the first address and look for other appearances of that canary value in the address space.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#125986 - Lick - Wed Apr 18, 2007 10:12 pm

tepples wrote:
Lick wrote:
Would erasing the checked location after each positive validation be a solution?

What you'll want to do after you determine which kilobytes of address space have RAM in them is write a canary value (e.g. 0xDEADBEEF) to the first address and look for other appearances of that canary value in the address space.


It's going to take a few seconds to look for a 4-byte value in potentially 32 megabytes of memory! I rather not write such a blocking library, hehe.

update: Oh by the way, I think I will implement Buddy memory allocation. Anyone have other suggestions or tips?
_________________
http://licklick.wordpress.com


Last edited by Lick on Wed Apr 18, 2007 10:25 pm; edited 2 times in total

#125988 - tepples - Wed Apr 18, 2007 10:24 pm

Lick wrote:
It's going to take a few seconds to look for a 4-byte value in potentially 32 megabytes of memory! I rather not write such a blocking library, hehe.

That's why I had GBFS search on 256 byte boundaries, and that's why you had your program search on 1 KiB boundaries. You could just search for mirroring canaries on 1 KiB boundaries too.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#125989 - Lick - Wed Apr 18, 2007 10:29 pm

Tatatatatatatatata-true! But I don't think it's worth it. Currently the code is reasonably fast and it works. But let us be reminded when errors start occurring.
_________________
http://licklick.wordpress.com

#125998 - felix123 - Wed Apr 18, 2007 11:59 pm

SCSD and SCminiSD
exactly the same result.

bar: 1234
total: 33554432
_________________
Nintendo DS homebrew on Wikipedia

#126012 - Lick - Thu Apr 19, 2007 4:56 am

http://lickr.org/files/exram2.zip

It should work on: Supercard, M3, Opera.
Newly added are: EZ3/4, EZ3in1, G6.

I have the feeling the new devices will fail. =(
Thanks for testing!
_________________
http://licklick.wordpress.com

#126017 - theli - Thu Apr 19, 2007 7:09 am

Lick wrote:
http://lickr.org/files/exram2.zipI have the feeling the new devices will fail. =(

G6 Lite
ram_init failed ;)

#126023 - Lick - Thu Apr 19, 2007 9:56 am

theli: thanks for testing. G6 is a bitch!

I don't have time to upload a new version right now, but I figured it out for EZ4.
EZ4 now has 16 MiB of RAM! HUGE CREDITS go to Cory1492!
This code should also work on EZ3-in-1.

Code:
//========================
vu16 *_ez_unlock ()
//========================
{
    sysSetBusOwners(BUS_OWNER_ARM9, BUS_OWNER_ARM9);

    //SetRompage(768/0x300); //0x9000000
    *(vu16*)0x9FE0000 = 0xD200;
    *(vu16*)0x8000000 = 0x1500;
    *(vu16*)0x8020000 = 0xD200;
    *(vu16*)0x8040000 = 0x1500;
    *(vu16*)0x9880000 = 0x300; // PSRAM to 0x9000000
    *(vu16*)0x9FC0000 = 0x1500;

    //OpenNorWrite()
    *(vu16*)0x9FE0000 = 0xD200;
    *(vu16*)0x8000000 = 0x1500;
    *(vu16*)0x8020000 = 0xD200;
    *(vu16*)0x8040000 = 0x1500;
    *(vu16*)0x9C40000 = 0x1500;
    *(vu16*)0x9FC0000 = 0x1500;

    return (vu16*)0x9000000;
}

//========================
void _ez_lock ()
//========================
{
    // CloseNorWrite()
   *(vu16*)0x9FE0000 = 0xD200;
   *(vu16*)0x8000000 = 0x1500;
   *(vu16*)0x8020000 = 0xD200;
   *(vu16*)0x8040000 = 0x1500;
   *(vu16*)0x9C40000 = 0xD200;
   *(vu16*)0x9FC0000 = 0x1500;
}

_________________
http://licklick.wordpress.com

#126024 - Lick - Thu Apr 19, 2007 10:35 am

exram3.nds
exram3.ds.gba

Should work: SC, Opera, M3, EZ3/4/3-in-1
Test needed: G6

Sorry for the random filehost.
- Lick
_________________
http://licklick.wordpress.com

#126025 - theli - Thu Apr 19, 2007 10:54 am

Lick wrote:
Test needed: G6

Code:
ram_init done
ram_size: 33554432

Test: 0 20 40 60 80
lock, unlock
Test: 0 20 40 60 80

#126026 - Lick - Thu Apr 19, 2007 11:00 am

Me died and me gone to heaven. //`( ^_^ )'\\ Thanks theli, bringer of good news!
_________________
http://licklick.wordpress.com

#126027 - OOPMan - Thu Apr 19, 2007 11:41 am

Good work lick, nice to see you turning your dab hand to the matter of RAM ;-)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#126031 - tepples - Thu Apr 19, 2007 2:16 pm

OOPMan wrote:
Good work lick, nice to see you turning your dab hand to the matter of RAM ;-)

On the other hand (olive flounder?), do these libraries support simultaneous use of libfat and RAM? The DLDIs may have to be updated so as not to step on RAM access.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#126033 - Lick - Thu Apr 19, 2007 2:22 pm

Before using the RAM you have to lock it. If you pair each lock with an unlock, I think it wouldn't conflict with libfat. Though I haven't done any testing yet.

But do note that (sgstair explained to me) the external RAM is slow, and should only be used when memory is more important than performance. There are ways to make it faster, DMAing to VRAM for example. For more information you should ask sgstair on IRC or something.

I'm cleaning the files up and then I'm posting them!
_________________
http://licklick.wordpress.com

#126034 - OOPMan - Thu Apr 19, 2007 2:30 pm

tepples wrote:
OOPMan wrote:
Good work lick, nice to see you turning your dab hand to the matter of RAM ;-)

On the other hand (olive flounder?), do these libraries support simultaneous use of libfat and RAM? The DLDIs may have to be updated so as not to step on RAM access.


Lick's reply pretty much answered as I suspected. RAM libs for the DS operating outside of an OS environment will probably have to rely on developer-level checking of RAM/FAT lock status.

'Course, under an OS the RAM might be contigious with normal memory or, at the very laest, managed by the OS to ensure the dev need not check for lock status.

But, this is a plain memory lib, so no frills here :-)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#126047 - Lick - Thu Apr 19, 2007 4:23 pm

I wrote a libfat+ram test. It works fine on my Supercard, but on my EZ4 it hangs at the second transition from ram to fat.

You guys care to figure out why? I really don't want to, right now. I am exhausted.
_________________
http://licklick.wordpress.com

#126127 - viruseb - Fri Apr 20, 2007 7:12 am

theli wrote:
Lick wrote:
Test needed: G6

Code:
ram_init done
ram_size: 33554432

Test: 0 20 40 60 80
lock, unlock
Test: 0 20 40 60 80


Same result for me.

#126148 - GizmoTheGreen - Fri Apr 20, 2007 10:19 am

exram3.nds didnt got Init_Ram failed
running on Neo2 SD, i ran the file from my ds-x though, will try booting from SD card on Neo2 itself when i get home, deos the Neo2 have any Ram to access?
_________________
Starter of the project TrueLoveDS :D
Will you find True Love?

#126155 - Lick - Fri Apr 20, 2007 11:14 am

I don't think Neo2 has, but even if it does, the test is not programmed for Neo2s.

Update maybe it does. On some retailer's website I found this interesting description "128M Zip RAM for compression, 256M flash RAM".
I believe the M stands for Mbit, so it makes 16MiB of "zip" RAM and 32MiB of flash RAM.
If we figure out how the zip RAM works, it might be usable as external RAM.

Update Wait a second.. So were you saying it actually WORKS? If so, what size does it report?
_________________
http://licklick.wordpress.com